rbreaves / kinto

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

Could xkeysnail config be simplied using variables? #691

Open joshgoebel opened 2 years ago

joshgoebel commented 2 years ago

Is your feature request related to a problem? Please describe.

It's a bit difficult to customize/understand kinto.sh as it's currently shipped.

Describe the solution you'd like

Consider using variables instead of commented out lines that are changed in mass:

GNOME = False
KDE = True
XFCE = False

Or perhaps just:

DE = "XFCE"

And then you'd build the maps themselves from separate dicts:

gui = {}
if DE == "XFCE":
   gui = gui | XFCE_GUI
elif DE == "Gnome":
  gui = gui | GNOME_GUI 

define_keymap(gui, "Common GUI") # etc

The point being that then all the utility script would need to do is change a single line in the file, set DE, etc... and let the python code do the work of build the proper keymaps.

Describe alternatives you've considered

None.

Additional context

Just trying to make working with mappings easier for someone who intends to make custom changes and add more to this file with time... being able to pull-down and integrate future changes Kinto adds would also be nice though.

joshgoebel commented 2 years ago

My latest example ended up in the emoji thread:

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"),