Open eugenesvk opened 11 months ago
For macOS at least, IMEs and keyboard layouts are pretty different things. When an app receives a key event, it will first send to the IME, and the IME can either choose to handle the event (by telling the app to insert some characters or display some underlined text), or the IME can let the app handle the event instead. If the app handles an event it'll use the current keyboard layout to determine what character to type, so if the IME does something different it might be confusing. Theoretically we could have the IME handle every event and translate them with a bundled keyboard layout, but then things like keyboard shortcuts in the underlying app would not work. So I don't think incorporating a keyboard layout directly into the IME is a good idea.
However, the IME is allowed to change the current keyboard layout (via overrideKeyboardWithKeyboardNamed
). For example, Google Japanese Input has an option called "always use the Japanese keyboard layout" which will always set the keyboard to "com.apple.keylayout.US". Maybe an option like that could work for you, if there's only one keyboard layout you'd like to type math with?
I think the option that could work if you could have two IMEs (I'd like to be able to input math in any language):
com.layout.US
andcom.layout.Non-US
but otherwise those two IMEs would be identical. So you could activate only these two IMEs instead of your layouts, then IME.
So then the only remaining downside would be that you'd still have two extra entries in the layout switcher (2 for the layouts, 2 for the IMEs)? Unless you can somehow make IME use a layout without said layout be enabled in the layout switcher?
I think it's possible to use a keyboard layout that's not enabled in the switcher, it only needs to be installed.
I think what you're describing is possible by providing multiple "input modes", similar to how Google Japanese Input provides both katakana and hirigana input modes in the layout switcher even though only one IME is installed. I think we'll need something like that for Windows too.
Currently the downside of using this IME is you have to explicitly switch to it, even though it only uses one key
\
as a trigger, so you could in principle slap it on top of an existing keyboard layout to extend it. This is especially an issue if you're already using multiple layouts, where instead of having just languages in the menu you also have Math, so you'd need two switches: target language then Math to be able to use math in a given languageIs it possible to somehow embed your IME to an existing keyboard layout? Or is this simply a completely different way of input vs. a regular layout, so you'd have to rewrite your existing layout to embed it to this IME?
Maybe it's not as could be implied in from your other comment https://github.com/knrafto/MathSymbolsInput/issues/19
but maybe it is possible? (can IMEs incorporate some layout?)