How do we open Keyboard Viewer programatically? I am working on Sonoma Mac Application.
I could open "Emoji & Symbols" programatically as follows.
NSArray *sources = (__bridge NSArray*)TISCreateInputSourceList(nil, false);
TISInputSourceRef keyboardViewer = (__bridge TISInputSourceRef)[sources objectAtIndex: 2]; // "Emoji & Symbols" is the 3rd one. So 2.
TISSelectInputSource(keyboardViewer);
CFRelease((CFTypeRef)sources);
After some searching, Keyboard Viewer could be opened with similiar approach with above in the old previous version of MacOS.
I have a strong feeling there is a way to bring up the keyboard because we can bring up "Emoji & Symbols". I mean, why would apple prevent us to show Keyboard Viewer.
Any idea?