koekeishiya / skhd

Simple hotkey daemon for macOS
MIT License
6.05k stars 204 forks source link

Output keypresses but using a different input source (language) #347

Open mdaeron opened 4 months ago

mdaeron commented 4 months ago

I write science texts with many isolated Greek letters, like this: δ13C. It's really slow to switch to Greek (even using a single keypress shortcut), type the letter, switch back to English (or forget switching back and type out garbled text).

I'm looking for a way to enable the following behavior: when I type the d key, output d, unless left-option is already pressed down, in which case output δ.

I tried the following config: alt - d : skhd --key z. That does replace alt - d by z. Happy so far. But how can I output δ instead of z? I guess I need to switch input sources in shell, but I'm not sure how to do that. Is there an obvious solution I'm missing, or is it just a matter of hunting down a good way to switch inputs from the command-line?