rbreaves / kinto

Mac-style shortcut keys for Linux & Windows.
http://kinto.sh
GNU General Public License v2.0
4.25k stars 213 forks source link

Add support for emote (emojis) on Linux #646

Open rbreaves opened 2 years ago

rbreaves commented 2 years ago

Remap emoji hotkey Ctrl-Alt-E to mac's keybinding of Ctrl-Cmd-Space.

https://github.com/tom-james-watson/Emote

joshgoebel commented 2 years ago

Are you planning to bundle an installer for emote as well or is this something users have to setup on their own? Are you going to make sure it's intended to stay running?

I'm interested in the hotkey part of it but if I do that I'm not sure what else might need to be done here?

joshgoebel commented 2 years ago

Doesn't this require two keymaps for some setups? Right now (for Mac Only) Ctrl is bound differently for Terminal and not, which means the combo needed to open the emoji picker is going to be different depending on whether I'm in a terminal or not... or do we not care about emoji in terminals?

I'm failing to see how I can write this once and it work with all the setups, or do you do this by writing a bunch of variants and then conditionallly uncommenting them, perhaps that's what all the complexity later is for. ☹️

joshgoebel commented 2 years ago

🌐OMG :)

🤣

    #  CmdCtrl -Space
    K("RC-LMeta-Space") : K("Ctrl-Alt-E"),
rbreaves commented 2 years ago

By default yea, the Terminal I would think would need a C-Shift-Space because basically those 2 bottom modifiers are both Control and Shift is added silently.

joshgoebel commented 2 years ago

I think you need to move the "per device" remapping into a lookup table and use those for your A function... then all of this becomes super simple... IE build the custom aliases you wanted just with Python.

MAC_ONLY = {
  "Cmd": "RC",
  "Alt" : "Alt",
  "Ctrl": "LSuper"
 }
WINMAC = {
  "Cmd": # ...,
  "Alt": #...
}

Then your A() function is:

SYS_MAP = WINMAC
#JS like-suedocode
def A(str):
  str.split("-").map(key => SYS_MAP[key] or key ).join("-")

IE, just take it apart, swap everything that is swap-able and put it back together... and as long as terminal is special you might need things like MAC and MAC_TERMINAL ... but then EVERYWHERE else (in all the keymaps) you'd just be reading the actual Mac shortcuts, straight out of the documentation.

joshgoebel commented 2 years ago

I think that will be a bit of a chore, but once you get thru it damn it should be nice.

joshgoebel commented 2 years ago

Would it be helpful it I made a PR for a single section, like Sublime Text 4? I'm only talking about kinto.py changes... you'd still need to go and alter your scripts to spit out/uncomment/add SYS_MAP = [SYSTEM] line... but that's all you should need to do setup wise.

Or are there other tuning knobs you have in "tweaks"?

joshgoebel commented 2 years ago

It's beautiful. :-)

CONVENIENCE = {
    "`": "grave",
    "[": "left_brace",
    "]": "right_brace",
}

MAC = {
    "Cmd": "RC",
    "Ctrl": "Super",
    # "Alt": "Alt"
}
L = K # L for Linux

SYS_MAP = MAC | CONVENIENCE

def Mac(str):
    rewritten = [SYS_MAP.get(key, key) for key in str.split("-")]
    return K("-".join(rewritten))

# keymapping
Mac("Cmd-Ctrl-Shift-F"): L("Shift-F11"),
joshgoebel commented 2 years ago

I prefer the longer alias names, but obviously that's just a preference.