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

Do we need a concept of static map? #690

Open joshgoebel opened 2 years ago

joshgoebel commented 2 years ago

I'm trying to have a STATIC mapping - such that Ctrl-left/right always maps to my Hyper-left/right, regardless of the active application.

But Kinto has dual modmaps for terminals/non-terminals:

define_conditional_modmap(lambda wm_class: wm_class.casefold() not in terminals,{
    # - Mac Only
    Key.LEFT_META: Key.RIGHT_CTRL,  # Mac
    Key.LEFT_CTRL: Key.LEFT_META,   # Mac
    Key.RIGHT_META: Key.RIGHT_CTRL, # Mac - Multi-language (Remove)
})

# [Conditional modmap] Change modifier keys in certain applications
define_conditional_modmap(re.compile(termStr, re.IGNORECASE), {
    Key.LEFT_META: Key.RIGHT_CTRL,  # Mac
    # Left Ctrl Stays Left Ctrl
    Key.RIGHT_META: Key.RIGHT_CTRL, # Mac - Multi-language (Remove)

Leading me to write code like this:

define_keymap(lambda wm_class: wm_class.casefold() not in terminals,{
    K("LSuper-LEFT"): K("Hyper-LEFT"),
    K("LSuper-RIGHT"): K("Hyper-RIGHT"),
},"screen paging (not term)")

define_keymap(re.compile(termStr, re.IGNORECASE), {
    K("C-LEFT"): K("Hyper-LEFT"),
    K("C-RIGHT"): K("Hyper-RIGHT"),
},"screen paging (term)")

See #681 for how this problem came to my attention, but even without such issues this is still very unintuitive... as is trying to read and understand all the RC-blah shortcuts for mac when they are really seaing Cmd-Blah... (but earlier we mapped Cmd to RC so now we're stuck typing RC everywhere).

I wonder if a static_map or some such concept might be introduced... where one could define mappings (likely global, DE, WM, etc that no modmaps applied too).... or perhaps some keymaps should be flagged such that they could avoid modmapping?

IE, what I'm really wanting:

keymap("global", {
    K("C-LEFT"): K("Hyper-LEFT"),
    K("C-RIGHT"): K("Hyper-RIGHT"),
}, always = True, modmap_allowed = False)

Meaning that Ctrl-Left and Ctrl-right ALWAYS map to Hyper-left/right, period - no exceptions, no remapping, etc... is this a crazy idea or would it simplify things? Originally posted by @joshgoebel in https://github.com/rbreaves/kinto/issues/681#issuecomment-1150112119