rbreaves / kinto

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

Fixes for numeric keypad PgUp/PgDn/Home/End and media key arrows #486

Open RedBearAK opened 3 years ago

RedBearAK commented 3 years ago

I don't think this is quite done, and I'm still wondering if there isn't a smarter or more compact way to do this, but I'm posting this as the beginning of a proposed solution to the problem of my numeric keypad navigation key codes (numpad arrows and PgUp/PgDn/Home/End key functions that are active when Numlock is off) not being treated like real navigation/cursor keys. It's a little tricky even if there were a generalized way to do it since some of the lines are remapping Ctrl to Super and vice versa.

Numpad keys by themselves are left out since that would interfere with actually using the numpad for numbers. Might add it later as an option, like with the media function arrow keys. Some people just may not care to ever use the numpad for numbers and want it to always behave like navigation/cursor keys. (Edit: Added numpad keys by themselves, commented out.) Label: [ (fix_numpad_nav_keys_base_key) ]

Includes work on being able to use arrow keys like those on my Acer Aspire A515-43, which are dedicated to the Play/Stop/FF/RW media functions, as if they were also real PgUp/PgDn/Home/End keys when used with any combination of modifiers (Shift/Ctrl/Alt/Super). Well, any one or two modifiers. Haven't done combinations of three or four modifiers. Not sure if I want to go that far. (Edit: Added all possible combinations of the 4 modifier keys.)

This is still very much a work in progress. Might just keep modifying this first post with updated code rather than adding new posts, except to answer questions if there are any.

Edit: Added a label to the numeric keypad lines for possible use in a tweak setting. [ (fix_numpad_nav_keys) ]

For the media keys fix, the lines for the "base key" (the key without any modifiers besides "Fn" key that activates the alternate hardware function) are commented out so the media keys are still usable by themselves for their intended media functions. But those lines could optionally be enabled if the user doesn't care about the media functions and really wants to use the arrows as PgUp/PgDn/Home/End in general use rather than as media keys. They are labeled at the end: [ (fix_media_keys_on_arrows_base_key) ]

It has to be noted here that these "base key" lines, if enabled, would naturally interfere with any keyboard that has dedicated media keys. I've seen some laptop keyboards that put the media keys above the rest of the numpad keys. It would turn those dedicated media keys into PgUp/PgDn/Home/End. So it's only useful for an odd keyboard like mine and should otherwise remain disabled.

The rest of the media key lines are for when the media arrow keys are used with other modifiers. They stop being "media keys" and get mapped to PgUp/PgDn/Home/End. They have a keyword at the end of each line that could be used to disable or enable all lines with sed in a Kinto tweak option. [ (fix_media_keys_on_arrows) ]

For use in the "General GUI" code block:

    ###########################################################################################################
    ###  Fixes for media functions on arrow/cursor keys in GTK apps 
    ###  Uncomment first 4 lines to make media key arrows always act as PgUp/PgDn/Home/End keys. 
    ###  WARNING: Base media key remapping this way will interfere with any 
    ###           dedicated "media" keys that use the same key codes! 
    ###========================================================================================================

    ###  Media keys with no modifier keys (base key)
    # K("PlayPause"):       K("Page_Up"),   # PlayPause media function (fix_media_keys_on_arrows_base_key)
    # K("StopCD"):          K("Page_Down"), # StopCD media function (fix_media_keys_on_arrows_base_key)
    # K("PreviousSong"):    K("Home"),      # PreviousSong media function (fix_media_keys_on_arrows_base_key)
    # K("NextSong"):        K("End"),       # NextSong media function (fix_media_keys_on_arrows_base_key)

    ###  Media keys with 1 modifier key
    K("Super-PlayPause"):               K("C-Page_Up"),                 # (fix_media_keys_on_arrows)
    K("Super-StopCD"):                  K("C-Page_Down"),               # (fix_media_keys_on_arrows)
    K("Super-PreviousSong"):            K("C-Home"),                    # (fix_media_keys_on_arrows)
    K("Super-NextSong"):                K("C-End"),                     # (fix_media_keys_on_arrows)

    K("Shift-PlayPause"):               K("Shift-Page_Up"),             # (fix_media_keys_on_arrows)
    K("Shift-StopCD"):                  K("Shift-Page_Down"),           # (fix_media_keys_on_arrows)
    K("Shift-PreviousSong"):            K("Shift-Home"),                # (fix_media_keys_on_arrows)
    K("Shift-NextSong"):                K("Shift-End"),                 # (fix_media_keys_on_arrows)

    K("M-PlayPause"):                   K("M-Page_Up"),                 # (fix_media_keys_on_arrows)
    K("M-StopCD"):                      K("M-Page_Down"),               # (fix_media_keys_on_arrows)
    K("M-PreviousSong"):                K("M-Home"),                    # (fix_media_keys_on_arrows)
    K("M-NextSong"):                    K("M-End"),                     # (fix_media_keys_on_arrows)

    K("RC-PlayPause"):                  K("Super-Page_Up"),             # (fix_media_keys_on_arrows)
    K("RC-StopCD"):                     K("Super-Page_Down"),           # (fix_media_keys_on_arrows)
    K("RC-PreviousSong"):               K("Super-Home"),                # (fix_media_keys_on_arrows)
    K("RC-NextSong"):                   K("Super-End"),                 # (fix_media_keys_on_arrows)

    ###  Media keys with 2 modifier keys
    K("Super-M-PlayPause"):             K("C-M-Page_Up"),               # (fix_media_keys_on_arrows)
    K("Super-M-StopCD"):                K("C-M-Page_Down"),             # (fix_media_keys_on_arrows)
    K("Super-M-PreviousSong"):          K("C-M-Home"),                  # (fix_media_keys_on_arrows)
    K("Super-M-NextSong"):              K("C-M-End"),                   # (fix_media_keys_on_arrows)

    K("Super-Shift-PlayPause"):         K("C-Shift-Page_Up"),           # (fix_media_keys_on_arrows)
    K("Super-Shift-StopCD"):            K("C-Shift-Page_Down"),         # (fix_media_keys_on_arrows)
    K("Super-Shift-PreviousSong"):      K("C-Shift-Home"),              # (fix_media_keys_on_arrows)
    K("Super-Shift-NextSong"):          K("C-Shift-End"),               # (fix_media_keys_on_arrows)

    K("Super-RC-PlayPause"):            K("C-Super-Page_Up"),           # (fix_media_keys_on_arrows)
    K("Super-RC-StopCD"):               K("C-Super-Page_Down"),         # (fix_media_keys_on_arrows)
    K("Super-RC-PreviousSong"):         K("C-Super-Home"),              # (fix_media_keys_on_arrows)
    K("Super-RC-NextSong"):             K("C-Super-End"),               # (fix_media_keys_on_arrows)

    K("M-Shift-PlayPause"):             K("M-Shift-Page_Up"),           # (fix_media_keys_on_arrows)
    K("M-Shift-StopCD"):                K("M-Shift-Page_Down"),         # (fix_media_keys_on_arrows)
    K("M-Shift-PreviousSong"):          K("M-Shift-Home"),              # (fix_media_keys_on_arrows)
    K("M-Shift-NextSong"):              K("M-Shift-End"),               # (fix_media_keys_on_arrows)

    K("M-RC-PlayPause"):                K("M-Super-Page_Up"),           # (fix_media_keys_on_arrows)
    K("M-RC-StopCD"):                   K("M-Super-Page_Down"),         # (fix_media_keys_on_arrows)
    K("M-RC-PreviousSong"):             K("M-Super-Home"),              # (fix_media_keys_on_arrows)
    K("M-RC-NextSong"):                 K("M-Super-End"),               # (fix_media_keys_on_arrows)

    K("Shift-RC-PlayPause"):            K("Shift-Super-Page_Up"),       # (fix_media_keys_on_arrows)
    K("Shift-RC-StopCD"):               K("Shift-Super-Page_Down"),     # (fix_media_keys_on_arrows)
    K("Shift-RC-PreviousSong"):         K("Shift-Super-Home"),          # (fix_media_keys_on_arrows)
    K("Shift-RC-NextSong"):             K("Shift-Super-End"),           # (fix_media_keys_on_arrows)

    ###  Media keys with 3 modifier keys
    K("Super-M-Shift-PlayPause"):       K("C-M-Shift-Page_Up"),         # (fix_media_keys_on_arrows)
    K("Super-M-Shift-StopCD"):          K("C-M-Shift-Page_Down"),       # (fix_media_keys_on_arrows)
    K("Super-M-Shift-PreviousSong"):    K("C-M-Shift-Home"),            # (fix_media_keys_on_arrows)
    K("Super-M-Shift-NextSong"):        K("C-M-Shift-End"),             # (fix_media_keys_on_arrows)

    K("Super-M-RC-PlayPause"):          K("C-M-Super-Page_Up"),         # (fix_media_keys_on_arrows)
    K("Super-M-RC-StopCD"):             K("C-M-Super-Page_Down"),       # (fix_media_keys_on_arrows)
    K("Super-M-RC-PreviousSong"):       K("C-M-Super-Home"),            # (fix_media_keys_on_arrows)
    K("Super-M-RC-NextSong"):           K("C-M-Super-End"),             # (fix_media_keys_on_arrows)

    K("Super-Shift-RC-PlayPause"):      K("C-Shift-Super-Page_Up"),     # (fix_media_keys_on_arrows)
    K("Super-Shift-RC-StopCD"):         K("C-Shift-Super-Page_Down"),   # (fix_media_keys_on_arrows)
    K("Super-Shift-RC-PreviousSong"):   K("C-Shift-Super-Home"),        # (fix_media_keys_on_arrows)
    K("Super-Shift-RC-NextSong"):       K("C-Shift-Super-End"),         # (fix_media_keys_on_arrows)

    K("M-Shift-RC-PlayPause"):          K("M-Shift-Super-Page_Up"),     # (fix_media_keys_on_arrows)
    K("M-Shift-RC-StopCD"):             K("M-Shift-Super-Page_Down"),   # (fix_media_keys_on_arrows)
    K("M-Shift-RC-PreviousSong"):       K("M-Shift-Super-Home"),        # (fix_media_keys_on_arrows)
    K("M-Shift-RC-NextSong"):           K("M-Shift-Super-End"),         # (fix_media_keys_on_arrows)

    ###  Media keys with 4 modifier keys
    K("Super-M-Shift-RC-PlayPause"):    K("C-M-Shift-Super-Page_Up"),   # (fix_media_keys_on_arrows)
    K("Super-M-Shift-RC-StopCD"):       K("C-M-Shift-Super-Page_Down"), # (fix_media_keys_on_arrows)
    K("Super-M-Shift-RC-PreviousSong"): K("C-M-Shift-Super-Home"),      # (fix_media_keys_on_arrows)
    K("Super-M-Shift-RC-NextSong"):     K("C-M-Shift-Super-End"),       # (fix_media_keys_on_arrows)

    ###========================================================================================================
    ###  END OF MEDIA KEYS ON ARROWS REMAPPING FIXES
    ###########################################################################################################

    ###########################################################################################################
    ###  Fixes for behavior of numeric keypad keys in GTK apps (arrows and PgDn/PgUp/Home/End)
    ###  Uncomment first 8 lines to make numpad navigation keys always act as PgUp/PgDn/Home/End/arrows. 
    ###  WARNING: Remapping the base keys this way will disable using numpad keys for numbers! 
    ###========================================================================================================

    ###  Keypad keys with no modifier keys (base key) 
    # K("KP9"):                   K("Page_Up"),                   # (fix_numpad_nav_keys_base_key)
    # K("KP3"):                   K("Page_Down"),                 # (fix_numpad_nav_keys_base_key)
    # K("KP7"):                   K("Home"),                      # (fix_numpad_nav_keys_base_key)
    # K("KP1"):                   K("End"),                       # (fix_numpad_nav_keys_base_key)
    # K("KP8"):                   K("Up"),                        # (fix_numpad_nav_keys_base_key)
    # K("KP2"):                   K("Down"),                      # (fix_numpad_nav_keys_base_key)
    # K("KP4"):                   K("Left"),                      # (fix_numpad_nav_keys_base_key)
    # K("KP6"):                   K("Right"),                     # (fix_numpad_nav_keys_base_key)

    ###  Keypad keys with 1 modifier key
    K("Super-KP9"):             K("C-Page_Up"),                 # (fix_numpad_nav_keys) 
    K("Super-KP3"):             K("C-Page_Down"),               # (fix_numpad_nav_keys) 
    K("Super-KP7"):             K("C-Home"),                    # (fix_numpad_nav_keys) 
    K("Super-KP1"):             K("C-End"),                     # (fix_numpad_nav_keys) 
    K("Super-KP8"):             K("C-Up"),                      # (fix_numpad_nav_keys) 
    K("Super-KP2"):             K("C-Down"),                    # (fix_numpad_nav_keys) 
    K("Super-KP4"):             K("C-Left"),                    # (fix_numpad_nav_keys) 
    K("Super-KP6"):             K("C-Right"),                   # (fix_numpad_nav_keys) 

    K("Shift-KP9"):             K("Shift-Page_Up"),             # (fix_numpad_nav_keys) 
    K("Shift-KP3"):             K("Shift-Page_Down"),           # (fix_numpad_nav_keys) 
    K("Shift-KP7"):             K("Shift-Home"),                # (fix_numpad_nav_keys) 
    K("Shift-KP1"):             K("Shift-End"),                 # (fix_numpad_nav_keys) 
    K("Shift-KP8"):             K("Shift-Up"),                  # (fix_numpad_nav_keys) 
    K("Shift-KP2"):             K("Shift-Down"),                # (fix_numpad_nav_keys) 
    K("Shift-KP4"):             K("Shift-Left"),                # (fix_numpad_nav_keys) 
    K("Shift-KP6"):             K("Shift-Right"),               # (fix_numpad_nav_keys) 

    K("M-KP9"):                 K("M-Page_Up"),                 # (fix_numpad_nav_keys) 
    K("M-KP3"):                 K("M-Page_Down"),               # (fix_numpad_nav_keys) 
    K("M-KP7"):                 K("M-Home"),                    # (fix_numpad_nav_keys) 
    K("M-KP1"):                 K("M-End"),                     # (fix_numpad_nav_keys) 
    K("M-KP8"):                 K("M-Up"),                      # (fix_numpad_nav_keys) 
    K("M-KP2"):                 K("M-Down"),                    # (fix_numpad_nav_keys) 
    K("M-KP4"):                 K("M-Left"),                    # (fix_numpad_nav_keys) 
    K("M-KP6"):                 K("M-Right"),                   # (fix_numpad_nav_keys) 

    K("RC-KP9"):                K("Super-Page_Up"),             # (fix_numpad_nav_keys) 
    K("RC-KP3"):                K("Super-Page_Down"),           # (fix_numpad_nav_keys) 
    K("RC-KP7"):                K("Super-Home"),                # (fix_numpad_nav_keys) 
    K("RC-KP1"):                K("Super-End"),                 # (fix_numpad_nav_keys) 
    K("RC-KP8"):                K("Super-Up"),                  # (fix_numpad_nav_keys) 
    K("RC-KP2"):                K("Super-Down"),                # (fix_numpad_nav_keys) 
    K("RC-KP4"):                K("Super-Left"),                # (fix_numpad_nav_keys) 
    K("RC-KP6"):                K("Super-Right"),               # (fix_numpad_nav_keys) 

    ###  Keypad keys with 2 modifier keys
    K("Super-M-KP9"):           K("C-M-Page_Up"),               # (fix_numpad_nav_keys) 
    K("Super-M-KP3"):           K("C-M-Page_Down"),             # (fix_numpad_nav_keys) 
    K("Super-M-KP7"):           K("C-M-Home"),                  # (fix_numpad_nav_keys) 
    K("Super-M-KP1"):           K("C-M-End"),                   # (fix_numpad_nav_keys) 
    K("Super-M-KP8"):           K("C-M-Up"),                    # (fix_numpad_nav_keys) 
    K("Super-M-KP2"):           K("C-M-Down"),                  # (fix_numpad_nav_keys) 
    K("Super-M-KP4"):           K("C-M-Left"),                  # (fix_numpad_nav_keys) 
    K("Super-M-KP6"):           K("C-M-Right"),                 # (fix_numpad_nav_keys) 

    K("Super-Shift-KP9"):       K("C-Shift-Page_Up"),           # (fix_numpad_nav_keys) 
    K("Super-Shift-KP3"):       K("C-Shift-Page_Down"),         # (fix_numpad_nav_keys) 
    K("Super-Shift-KP7"):       K("C-Shift-Home"),              # (fix_numpad_nav_keys) 
    K("Super-Shift-KP1"):       K("C-Shift-End"),               # (fix_numpad_nav_keys) 
    K("Super-Shift-KP8"):       K("C-Shift-Up"),                # (fix_numpad_nav_keys) 
    K("Super-Shift-KP2"):       K("C-Shift-Down"),              # (fix_numpad_nav_keys) 
    K("Super-Shift-KP4"):       K("C-Shift-Left"),              # (fix_numpad_nav_keys) 
    K("Super-Shift-KP6"):       K("C-Shift-Right"),             # (fix_numpad_nav_keys) 

    K("Super-RC-KP9"):          K("C-Super-Page_Up"),           # (fix_numpad_nav_keys) 
    K("Super-RC-KP3"):          K("C-Super-Page_Down"),         # (fix_numpad_nav_keys) 
    K("Super-RC-KP7"):          K("C-Super-Home"),              # (fix_numpad_nav_keys) 
    K("Super-RC-KP1"):          K("C-Super-End"),               # (fix_numpad_nav_keys) 
    K("Super-RC-KP8"):          K("C-Super-Up"),                # (fix_numpad_nav_keys) 
    K("Super-RC-KP2"):          K("C-Super-Down"),              # (fix_numpad_nav_keys) 
    K("Super-RC-KP4"):          K("C-Super-Left"),              # (fix_numpad_nav_keys) 
    K("Super-RC-KP6"):          K("C-Super-Right"),             # (fix_numpad_nav_keys) 

    K("M-Shift-KP9"):           K("M-Shift-Page_Up"),           # (fix_numpad_nav_keys) 
    K("M-Shift-KP3"):           K("M-Shift-Page_Down"),         # (fix_numpad_nav_keys) 
    K("M-Shift-KP7"):           K("M-Shift-Home"),              # (fix_numpad_nav_keys) 
    K("M-Shift-KP1"):           K("M-Shift-End"),               # (fix_numpad_nav_keys) 
    K("M-Shift-KP8"):           K("M-Shift-Up"),                # (fix_numpad_nav_keys) 
    K("M-Shift-KP2"):           K("M-Shift-Down"),              # (fix_numpad_nav_keys) 
    K("M-Shift-KP4"):           K("M-Shift-Left"),              # (fix_numpad_nav_keys) 
    K("M-Shift-KP6"):           K("M-Shift-Right"),             # (fix_numpad_nav_keys) 

    K("M-RC-KP9"):              K("M-Super-Page_Up"),           # (fix_numpad_nav_keys) 
    K("M-RC-KP3"):              K("M-Super-Page_Down"),         # (fix_numpad_nav_keys) 
    K("M-RC-KP7"):              K("M-Super-Home"),              # (fix_numpad_nav_keys) 
    K("M-RC-KP1"):              K("M-Super-End"),               # (fix_numpad_nav_keys) 
    K("M-RC-KP8"):              K("M-Super-Up"),                # (fix_numpad_nav_keys) 
    K("M-RC-KP2"):              K("M-Super-Down"),              # (fix_numpad_nav_keys) 
    K("M-RC-KP4"):              K("M-Super-Left"),              # (fix_numpad_nav_keys) 
    K("M-RC-KP6"):              K("M-Super-Right"),             # (fix_numpad_nav_keys) 

    K("Shift-RC-KP9"):          K("Shift-Super-Page_Up"),       # (fix_numpad_nav_keys) 
    K("Shift-RC-KP3"):          K("Shift-Super-Page_Down"),     # (fix_numpad_nav_keys) 
    K("Shift-RC-KP7"):          K("Shift-Super-Home"),          # (fix_numpad_nav_keys) 
    K("Shift-RC-KP1"):          K("Shift-Super-End"),           # (fix_numpad_nav_keys) 
    K("Shift-RC-KP8"):          K("Shift-Super-Up"),            # (fix_numpad_nav_keys) 
    K("Shift-RC-KP2"):          K("Shift-Super-Down"),          # (fix_numpad_nav_keys) 
    K("Shift-RC-KP4"):          K("Shift-Super-Left"),          # (fix_numpad_nav_keys) 
    K("Shift-RC-KP6"):          K("Shift-Super-Right"),         # (fix_numpad_nav_keys) 

    ###  Keypad keys with 3 modifier keys
    K("Super-M-Shift-KP9"):     K("M-Shift-Super-Page_Up"),     # (fix_numpad_nav_keys) 
    K("Super-M-Shift-KP3"):     K("M-Shift-Super-Page_Down"),   # (fix_numpad_nav_keys) 
    K("Super-M-Shift-KP7"):     K("M-Shift-Super-Home"),        # (fix_numpad_nav_keys) 
    K("Super-M-Shift-KP1"):     K("M-Shift-Super-End"),         # (fix_numpad_nav_keys) 
    K("Super-M-Shift-KP8"):     K("M-Shift-Super-Up"),          # (fix_numpad_nav_keys) 
    K("Super-M-Shift-KP2"):     K("M-Shift-Super-Down"),        # (fix_numpad_nav_keys) 
    K("Super-M-Shift-KP4"):     K("M-Shift-Super-Left"),        # (fix_numpad_nav_keys) 
    K("Super-M-Shift-KP6"):     K("M-Shift-Super-Right"),       # (fix_numpad_nav_keys) 

    K("Super-M-RC-KP9"):        K("C-M-Super-Page_Up"),         # (fix_numpad_nav_keys) 
    K("Super-M-RC-KP3"):        K("C-M-Super-Page_Down"),       # (fix_numpad_nav_keys) 
    K("Super-M-RC-KP7"):        K("C-M-Super-Home"),            # (fix_numpad_nav_keys) 
    K("Super-M-RC-KP1"):        K("C-M-Super-End"),             # (fix_numpad_nav_keys) 
    K("Super-M-RC-KP8"):        K("C-M-Super-Up"),              # (fix_numpad_nav_keys) 
    K("Super-M-RC-KP2"):        K("C-M-Super-Down"),            # (fix_numpad_nav_keys) 
    K("Super-M-RC-KP4"):        K("C-M-Super-Left"),            # (fix_numpad_nav_keys) 
    K("Super-M-RC-KP6"):        K("C-M-Super-Right"),           # (fix_numpad_nav_keys) 

    K("Super-Shift-RC-KP9"):    K("C-Shift-Super-Page_Up"),     # (fix_numpad_nav_keys) 
    K("Super-Shift-RC-KP3"):    K("C-Shift-Super-Page_Down"),   # (fix_numpad_nav_keys) 
    K("Super-Shift-RC-KP7"):    K("C-Shift-Super-Home"),        # (fix_numpad_nav_keys) 
    K("Super-Shift-RC-KP1"):    K("C-Shift-Super-End"),         # (fix_numpad_nav_keys) 
    K("Super-Shift-RC-KP8"):    K("C-Shift-Super-Up"),          # (fix_numpad_nav_keys) 
    K("Super-Shift-RC-KP2"):    K("C-Shift-Super-Down"),        # (fix_numpad_nav_keys) 
    K("Super-Shift-RC-KP4"):    K("C-Shift-Super-Left"),        # (fix_numpad_nav_keys) 
    K("Super-Shift-RC-KP6"):    K("C-Shift-Super-Right"),       # (fix_numpad_nav_keys) 

    K("M-Shift-RC-KP9"):        K("M-Shift-Super-Page_Up"),     # (fix_numpad_nav_keys) 
    K("M-Shift-RC-KP3"):        K("M-Shift-Super-Page_Down"),   # (fix_numpad_nav_keys) 
    K("M-Shift-RC-KP7"):        K("M-Shift-Super-Home"),        # (fix_numpad_nav_keys) 
    K("M-Shift-RC-KP1"):        K("M-Shift-Super-End"),         # (fix_numpad_nav_keys) 
    K("M-Shift-RC-KP8"):        K("M-Shift-Super-Up"),          # (fix_numpad_nav_keys) 
    K("M-Shift-RC-KP2"):        K("M-Shift-Super-Down"),        # (fix_numpad_nav_keys) 
    K("M-Shift-RC-KP4"):        K("M-Shift-Super-Left"),        # (fix_numpad_nav_keys) 
    K("M-Shift-RC-KP6"):        K("M-Shift-Super-Right"),       # (fix_numpad_nav_keys) 

    ###  Keypad keys with 4 modifier keys
    K("Super-M-Shift-RC-KP9"):  K("C-M-Shift-Super-Page_Up"),   # (fix_numpad_nav_keys) 
    K("Super-M-Shift-RC-KP3"):  K("C-M-Shift-Super-Page_Down"), # (fix_numpad_nav_keys) 
    K("Super-M-Shift-RC-KP7"):  K("C-M-Shift-Super-Home"),      # (fix_numpad_nav_keys) 
    K("Super-M-Shift-RC-KP1"):  K("C-M-Shift-Super-End"),       # (fix_numpad_nav_keys) 
    K("Super-M-Shift-RC-KP8"):  K("C-M-Shift-Super-Up"),        # (fix_numpad_nav_keys) 
    K("Super-M-Shift-RC-KP2"):  K("C-M-Shift-Super-Down"),      # (fix_numpad_nav_keys) 
    K("Super-M-Shift-RC-KP4"):  K("C-M-Shift-Super-Left"),      # (fix_numpad_nav_keys) 
    K("Super-M-Shift-RC-KP6"):  K("C-M-Shift-Super-Right"),     # (fix_numpad_nav_keys) 

    ###========================================================================================================
    ###  END OF NUMERIC KEYPAD REMAPPING FIXES
    ###########################################################################################################

. . For use in the termStr code block (replacing Super on the left/origin side of the mapping with LC since there is no Super in terminal modifier mapping).

    ###########################################################################################################
    ###  Fixes for media functions on arrow/cursor keys in GTK apps 
    ###  Uncomment first 4 lines to make media key arrows always act as PgUp/PgDn/Home/End keys. 
    ###  WARNING: Base media key remapping this way will interfere with any 
    ###           dedicated "media" keys that use the same key codes! 
    ###========================================================================================================

    ###  Media keys with no modifier keys (base key)
    # K("PlayPause"):       K("Page_Up"),   # PlayPause media function (fix_media_keys_on_arrows_base_key)
    # K("StopCD"):          K("Page_Down"), # StopCD media function (fix_media_keys_on_arrows_base_key)
    # K("PreviousSong"):    K("Home"),      # PreviousSong media function (fix_media_keys_on_arrows_base_key)
    # K("NextSong"):        K("End"),       # NextSong media function (fix_media_keys_on_arrows_base_key)

    ###  Media keys with 1 modifier key
    K("LC-PlayPause"):                  K("C-Page_Up"),                 # (fix_media_keys_on_arrows)
    K("LC-StopCD"):                     K("C-Page_Down"),               # (fix_media_keys_on_arrows)
    K("LC-PreviousSong"):               K("C-Home"),                    # (fix_media_keys_on_arrows)
    K("LC-NextSong"):                   K("C-End"),                     # (fix_media_keys_on_arrows)

    K("Shift-PlayPause"):               K("Shift-Page_Up"),             # (fix_media_keys_on_arrows)
    K("Shift-StopCD"):                  K("Shift-Page_Down"),           # (fix_media_keys_on_arrows)
    K("Shift-PreviousSong"):            K("Shift-Home"),                # (fix_media_keys_on_arrows)
    K("Shift-NextSong"):                K("Shift-End"),                 # (fix_media_keys_on_arrows)

    K("M-PlayPause"):                   K("M-Page_Up"),                 # (fix_media_keys_on_arrows)
    K("M-StopCD"):                      K("M-Page_Down"),               # (fix_media_keys_on_arrows)
    K("M-PreviousSong"):                K("M-Home"),                    # (fix_media_keys_on_arrows)
    K("M-NextSong"):                    K("M-End"),                     # (fix_media_keys_on_arrows)

    K("RC-PlayPause"):                  K("Super-Page_Up"),             # (fix_media_keys_on_arrows)
    K("RC-StopCD"):                     K("Super-Page_Down"),           # (fix_media_keys_on_arrows)
    K("RC-PreviousSong"):               K("Super-Home"),                # (fix_media_keys_on_arrows)
    K("RC-NextSong"):                   K("Super-End"),                 # (fix_media_keys_on_arrows)

    ###  Media keys with 2 modifier keys
    K("LC-M-PlayPause"):                K("C-M-Page_Up"),               # (fix_media_keys_on_arrows)
    K("LC-M-StopCD"):                   K("C-M-Page_Down"),             # (fix_media_keys_on_arrows)
    K("LC-M-PreviousSong"):             K("C-M-Home"),                  # (fix_media_keys_on_arrows)
    K("LC-M-NextSong"):                 K("C-M-End"),                   # (fix_media_keys_on_arrows)

    K("LC-Shift-PlayPause"):            K("C-Shift-Page_Up"),           # (fix_media_keys_on_arrows)
    K("LC-Shift-StopCD"):               K("C-Shift-Page_Down"),         # (fix_media_keys_on_arrows)
    K("LC-Shift-PreviousSong"):         K("C-Shift-Home"),              # (fix_media_keys_on_arrows)
    K("LC-Shift-NextSong"):             K("C-Shift-End"),               # (fix_media_keys_on_arrows)

    K("LC-RC-PlayPause"):               K("C-Super-Page_Up"),           # (fix_media_keys_on_arrows)
    K("LC-RC-StopCD"):                  K("C-Super-Page_Down"),         # (fix_media_keys_on_arrows)
    K("LC-RC-PreviousSong"):            K("C-Super-Home"),              # (fix_media_keys_on_arrows)
    K("LC-RC-NextSong"):                K("C-Super-End"),               # (fix_media_keys_on_arrows)

    K("M-Shift-PlayPause"):             K("M-Shift-Page_Up"),           # (fix_media_keys_on_arrows)
    K("M-Shift-StopCD"):                K("M-Shift-Page_Down"),         # (fix_media_keys_on_arrows)
    K("M-Shift-PreviousSong"):          K("M-Shift-Home"),              # (fix_media_keys_on_arrows)
    K("M-Shift-NextSong"):              K("M-Shift-End"),               # (fix_media_keys_on_arrows)

    K("M-RC-PlayPause"):                K("M-Super-Page_Up"),           # (fix_media_keys_on_arrows)
    K("M-RC-StopCD"):                   K("M-Super-Page_Down"),         # (fix_media_keys_on_arrows)
    K("M-RC-PreviousSong"):             K("M-Super-Home"),              # (fix_media_keys_on_arrows)
    K("M-RC-NextSong"):                 K("M-Super-End"),               # (fix_media_keys_on_arrows)

    K("Shift-RC-PlayPause"):            K("Shift-Super-Page_Up"),       # (fix_media_keys_on_arrows)
    K("Shift-RC-StopCD"):               K("Shift-Super-Page_Down"),     # (fix_media_keys_on_arrows)
    K("Shift-RC-PreviousSong"):         K("Shift-Super-Home"),          # (fix_media_keys_on_arrows)
    K("Shift-RC-NextSong"):             K("Shift-Super-End"),           # (fix_media_keys_on_arrows)

    ###  Media keys with 3 modifier keys
    K("LC-M-Shift-PlayPause"):          K("C-M-Shift-Page_Up"),         # (fix_media_keys_on_arrows)
    K("LC-M-Shift-StopCD"):             K("C-M-Shift-Page_Down"),       # (fix_media_keys_on_arrows)
    K("LC-M-Shift-PreviousSong"):       K("C-M-Shift-Home"),            # (fix_media_keys_on_arrows)
    K("LC-M-Shift-NextSong"):           K("C-M-Shift-End"),             # (fix_media_keys_on_arrows)

    K("LC-M-RC-PlayPause"):             K("C-M-Super-Page_Up"),         # (fix_media_keys_on_arrows)
    K("LC-M-RC-StopCD"):                K("C-M-Super-Page_Down"),       # (fix_media_keys_on_arrows)
    K("LC-M-RC-PreviousSong"):          K("C-M-Super-Home"),            # (fix_media_keys_on_arrows)
    K("LC-M-RC-NextSong"):              K("C-M-Super-End"),             # (fix_media_keys_on_arrows)

    K("LC-Shift-RC-PlayPause"):         K("C-Shift-Super-Page_Up"),     # (fix_media_keys_on_arrows)
    K("LC-Shift-RC-StopCD"):            K("C-Shift-Super-Page_Down"),   # (fix_media_keys_on_arrows)
    K("LC-Shift-RC-PreviousSong"):      K("C-Shift-Super-Home"),        # (fix_media_keys_on_arrows)
    K("LC-Shift-RC-NextSong"):          K("C-Shift-Super-End"),         # (fix_media_keys_on_arrows)

    K("M-Shift-RC-PlayPause"):          K("M-Shift-Super-Page_Up"),     # (fix_media_keys_on_arrows)
    K("M-Shift-RC-StopCD"):             K("M-Shift-Super-Page_Down"),   # (fix_media_keys_on_arrows)
    K("M-Shift-RC-PreviousSong"):       K("M-Shift-Super-Home"),        # (fix_media_keys_on_arrows)
    K("M-Shift-RC-NextSong"):           K("M-Shift-Super-End"),         # (fix_media_keys_on_arrows)

    ###  Media keys with 4 modifier keys
    K("LC-M-Shift-RC-PlayPause"):       K("C-M-Shift-Super-Page_Up"),   # (fix_media_keys_on_arrows)
    K("LC-M-Shift-RC-StopCD"):          K("C-M-Shift-Super-Page_Down"), # (fix_media_keys_on_arrows)
    K("LC-M-Shift-RC-PreviousSong"):    K("C-M-Shift-Super-Home"),      # (fix_media_keys_on_arrows)
    K("LC-M-Shift-RC-NextSong"):        K("C-M-Shift-Super-End"),       # (fix_media_keys_on_arrows)

    ###========================================================================================================
    ###  END OF MEDIA KEYS ON ARROWS REMAPPING FIXES
    ###########################################################################################################

    ###########################################################################################################
    ###  Fixes for behavior of numeric keypad keys in GTK apps (arrows and PgDn/PgUp/Home/End)
    ###  Uncomment first 8 lines to make numpad navigation keys always act as PgUp/PgDn/Home/End/arrows. 
    ###  WARNING: Remapping the base keys this way will disable using numpad keys for numbers! 
    ###========================================================================================================

    ###  Keypad keys with no modifier keys (base key) 
    # K("KP9"):                   K("Page_Up"),                   # (fix_numpad_nav_keys_base_key)
    # K("KP3"):                   K("Page_Down"),                 # (fix_numpad_nav_keys_base_key)
    # K("KP7"):                   K("Home"),                      # (fix_numpad_nav_keys_base_key)
    # K("KP1"):                   K("End"),                       # (fix_numpad_nav_keys_base_key)
    # K("KP8"):                   K("Up"),                        # (fix_numpad_nav_keys_base_key)
    # K("KP2"):                   K("Down"),                      # (fix_numpad_nav_keys_base_key)
    # K("KP4"):                   K("Left"),                      # (fix_numpad_nav_keys_base_key)
    # K("KP6"):                   K("Right"),                     # (fix_numpad_nav_keys_base_key)

    ###  Keypad keys with 1 modifier key
    K("LC-KP9"):                K("C-Page_Up"),                 # (fix_numpad_nav_keys) 
    K("LC-KP3"):                K("C-Page_Down"),               # (fix_numpad_nav_keys) 
    K("LC-KP7"):                K("C-Home"),                    # (fix_numpad_nav_keys) 
    K("LC-KP1"):                K("C-End"),                     # (fix_numpad_nav_keys) 
    K("LC-KP8"):                K("C-Up"),                      # (fix_numpad_nav_keys) 
    K("LC-KP2"):                K("C-Down"),                    # (fix_numpad_nav_keys) 
    K("LC-KP4"):                K("C-Left"),                    # (fix_numpad_nav_keys) 
    K("LC-KP6"):                K("C-Right"),                   # (fix_numpad_nav_keys) 

    K("Shift-KP9"):             K("Shift-Page_Up"),             # (fix_numpad_nav_keys) 
    K("Shift-KP3"):             K("Shift-Page_Down"),           # (fix_numpad_nav_keys) 
    K("Shift-KP7"):             K("Shift-Home"),                # (fix_numpad_nav_keys) 
    K("Shift-KP1"):             K("Shift-End"),                 # (fix_numpad_nav_keys) 
    K("Shift-KP8"):             K("Shift-Up"),                  # (fix_numpad_nav_keys) 
    K("Shift-KP2"):             K("Shift-Down"),                # (fix_numpad_nav_keys) 
    K("Shift-KP4"):             K("Shift-Left"),                # (fix_numpad_nav_keys) 
    K("Shift-KP6"):             K("Shift-Right"),               # (fix_numpad_nav_keys) 

    K("M-KP9"):                 K("M-Page_Up"),                 # (fix_numpad_nav_keys) 
    K("M-KP3"):                 K("M-Page_Down"),               # (fix_numpad_nav_keys) 
    K("M-KP7"):                 K("M-Home"),                    # (fix_numpad_nav_keys) 
    K("M-KP1"):                 K("M-End"),                     # (fix_numpad_nav_keys) 
    K("M-KP8"):                 K("M-Up"),                      # (fix_numpad_nav_keys) 
    K("M-KP2"):                 K("M-Down"),                    # (fix_numpad_nav_keys) 
    K("M-KP4"):                 K("M-Left"),                    # (fix_numpad_nav_keys) 
    K("M-KP6"):                 K("M-Right"),                   # (fix_numpad_nav_keys) 

    K("RC-KP9"):                K("Super-Page_Up"),             # (fix_numpad_nav_keys) 
    K("RC-KP3"):                K("Super-Page_Down"),           # (fix_numpad_nav_keys) 
    K("RC-KP7"):                K("Super-Home"),                # (fix_numpad_nav_keys) 
    K("RC-KP1"):                K("Super-End"),                 # (fix_numpad_nav_keys) 
    K("RC-KP8"):                K("Super-Up"),                  # (fix_numpad_nav_keys) 
    K("RC-KP2"):                K("Super-Down"),                # (fix_numpad_nav_keys) 
    K("RC-KP4"):                K("Super-Left"),                # (fix_numpad_nav_keys) 
    K("RC-KP6"):                K("Super-Right"),               # (fix_numpad_nav_keys) 

    ###  Keypad keys with 2 modifier keys
    K("LC-M-KP9"):              K("C-M-Page_Up"),               # (fix_numpad_nav_keys) 
    K("LC-M-KP3"):              K("C-M-Page_Down"),             # (fix_numpad_nav_keys) 
    K("LC-M-KP7"):              K("C-M-Home"),                  # (fix_numpad_nav_keys) 
    K("LC-M-KP1"):              K("C-M-End"),                   # (fix_numpad_nav_keys) 
    K("LC-M-KP8"):              K("C-M-Up"),                    # (fix_numpad_nav_keys) 
    K("LC-M-KP2"):              K("C-M-Down"),                  # (fix_numpad_nav_keys) 
    K("LC-M-KP4"):              K("C-M-Left"),                  # (fix_numpad_nav_keys) 
    K("LC-M-KP6"):              K("C-M-Right"),                 # (fix_numpad_nav_keys) 

    K("LC-Shift-KP9"):          K("C-Shift-Page_Up"),           # (fix_numpad_nav_keys) 
    K("LC-Shift-KP3"):          K("C-Shift-Page_Down"),         # (fix_numpad_nav_keys) 
    K("LC-Shift-KP7"):          K("C-Shift-Home"),              # (fix_numpad_nav_keys) 
    K("LC-Shift-KP1"):          K("C-Shift-End"),               # (fix_numpad_nav_keys) 
    K("LC-Shift-KP8"):          K("C-Shift-Up"),                # (fix_numpad_nav_keys) 
    K("LC-Shift-KP2"):          K("C-Shift-Down"),              # (fix_numpad_nav_keys) 
    K("LC-Shift-KP4"):          K("C-Shift-Left"),              # (fix_numpad_nav_keys) 
    K("LC-Shift-KP6"):          K("C-Shift-Right"),             # (fix_numpad_nav_keys) 

    K("LC-RC-KP9"):             K("C-Super-Page_Up"),           # (fix_numpad_nav_keys) 
    K("LC-RC-KP3"):             K("C-Super-Page_Down"),         # (fix_numpad_nav_keys) 
    K("LC-RC-KP7"):             K("C-Super-Home"),              # (fix_numpad_nav_keys) 
    K("LC-RC-KP1"):             K("C-Super-End"),               # (fix_numpad_nav_keys) 
    K("LC-RC-KP8"):             K("C-Super-Up"),                # (fix_numpad_nav_keys) 
    K("LC-RC-KP2"):             K("C-Super-Down"),              # (fix_numpad_nav_keys) 
    K("LC-RC-KP4"):             K("C-Super-Left"),              # (fix_numpad_nav_keys) 
    K("LC-RC-KP6"):             K("C-Super-Right"),             # (fix_numpad_nav_keys) 

    K("M-Shift-KP9"):           K("M-Shift-Page_Up"),           # (fix_numpad_nav_keys) 
    K("M-Shift-KP3"):           K("M-Shift-Page_Down"),         # (fix_numpad_nav_keys) 
    K("M-Shift-KP7"):           K("M-Shift-Home"),              # (fix_numpad_nav_keys) 
    K("M-Shift-KP1"):           K("M-Shift-End"),               # (fix_numpad_nav_keys) 
    K("M-Shift-KP8"):           K("M-Shift-Up"),                # (fix_numpad_nav_keys) 
    K("M-Shift-KP2"):           K("M-Shift-Down"),              # (fix_numpad_nav_keys) 
    K("M-Shift-KP4"):           K("M-Shift-Left"),              # (fix_numpad_nav_keys) 
    K("M-Shift-KP6"):           K("M-Shift-Right"),             # (fix_numpad_nav_keys) 

    K("M-RC-KP9"):              K("M-Super-Page_Up"),           # (fix_numpad_nav_keys) 
    K("M-RC-KP3"):              K("M-Super-Page_Down"),         # (fix_numpad_nav_keys) 
    K("M-RC-KP7"):              K("M-Super-Home"),              # (fix_numpad_nav_keys) 
    K("M-RC-KP1"):              K("M-Super-End"),               # (fix_numpad_nav_keys) 
    K("M-RC-KP8"):              K("M-Super-Up"),                # (fix_numpad_nav_keys) 
    K("M-RC-KP2"):              K("M-Super-Down"),              # (fix_numpad_nav_keys) 
    K("M-RC-KP4"):              K("M-Super-Left"),              # (fix_numpad_nav_keys) 
    K("M-RC-KP6"):              K("M-Super-Right"),             # (fix_numpad_nav_keys) 

    K("Shift-RC-KP9"):          K("Shift-Super-Page_Up"),       # (fix_numpad_nav_keys) 
    K("Shift-RC-KP3"):          K("Shift-Super-Page_Down"),     # (fix_numpad_nav_keys) 
    K("Shift-RC-KP7"):          K("Shift-Super-Home"),          # (fix_numpad_nav_keys) 
    K("Shift-RC-KP1"):          K("Shift-Super-End"),           # (fix_numpad_nav_keys) 
    K("Shift-RC-KP8"):          K("Shift-Super-Up"),            # (fix_numpad_nav_keys) 
    K("Shift-RC-KP2"):          K("Shift-Super-Down"),          # (fix_numpad_nav_keys) 
    K("Shift-RC-KP4"):          K("Shift-Super-Left"),          # (fix_numpad_nav_keys) 
    K("Shift-RC-KP6"):          K("Shift-Super-Right"),         # (fix_numpad_nav_keys) 

    ###  Keypad keys with 3 modifier keys
    K("LC-M-Shift-KP9"):        K("M-Shift-Super-Page_Up"),     # (fix_numpad_nav_keys) 
    K("LC-M-Shift-KP3"):        K("M-Shift-Super-Page_Down"),   # (fix_numpad_nav_keys) 
    K("LC-M-Shift-KP7"):        K("M-Shift-Super-Home"),        # (fix_numpad_nav_keys) 
    K("LC-M-Shift-KP1"):        K("M-Shift-Super-End"),         # (fix_numpad_nav_keys) 
    K("LC-M-Shift-KP8"):        K("M-Shift-Super-Up"),          # (fix_numpad_nav_keys) 
    K("LC-M-Shift-KP2"):        K("M-Shift-Super-Down"),        # (fix_numpad_nav_keys) 
    K("LC-M-Shift-KP4"):        K("M-Shift-Super-Left"),        # (fix_numpad_nav_keys) 
    K("LC-M-Shift-KP6"):        K("M-Shift-Super-Right"),       # (fix_numpad_nav_keys) 

    K("LC-M-RC-KP9"):           K("C-M-Super-Page_Up"),         # (fix_numpad_nav_keys) 
    K("LC-M-RC-KP3"):           K("C-M-Super-Page_Down"),       # (fix_numpad_nav_keys) 
    K("LC-M-RC-KP7"):           K("C-M-Super-Home"),            # (fix_numpad_nav_keys) 
    K("LC-M-RC-KP1"):           K("C-M-Super-End"),             # (fix_numpad_nav_keys) 
    K("LC-M-RC-KP8"):           K("C-M-Super-Up"),              # (fix_numpad_nav_keys) 
    K("LC-M-RC-KP2"):           K("C-M-Super-Down"),            # (fix_numpad_nav_keys) 
    K("LC-M-RC-KP4"):           K("C-M-Super-Left"),            # (fix_numpad_nav_keys) 
    K("LC-M-RC-KP6"):           K("C-M-Super-Right"),           # (fix_numpad_nav_keys) 

    K("LC-Shift-RC-KP9"):       K("C-Shift-Super-Page_Up"),     # (fix_numpad_nav_keys) 
    K("LC-Shift-RC-KP3"):       K("C-Shift-Super-Page_Down"),   # (fix_numpad_nav_keys) 
    K("LC-Shift-RC-KP7"):       K("C-Shift-Super-Home"),        # (fix_numpad_nav_keys) 
    K("LC-Shift-RC-KP1"):       K("C-Shift-Super-End"),         # (fix_numpad_nav_keys) 
    K("LC-Shift-RC-KP8"):       K("C-Shift-Super-Up"),          # (fix_numpad_nav_keys) 
    K("LC-Shift-RC-KP2"):       K("C-Shift-Super-Down"),        # (fix_numpad_nav_keys) 
    K("LC-Shift-RC-KP4"):       K("C-Shift-Super-Left"),        # (fix_numpad_nav_keys) 
    K("LC-Shift-RC-KP6"):       K("C-Shift-Super-Right"),       # (fix_numpad_nav_keys) 

    K("M-Shift-RC-KP9"):        K("M-Shift-Super-Page_Up"),     # (fix_numpad_nav_keys) 
    K("M-Shift-RC-KP3"):        K("M-Shift-Super-Page_Down"),   # (fix_numpad_nav_keys) 
    K("M-Shift-RC-KP7"):        K("M-Shift-Super-Home"),        # (fix_numpad_nav_keys) 
    K("M-Shift-RC-KP1"):        K("M-Shift-Super-End"),         # (fix_numpad_nav_keys) 
    K("M-Shift-RC-KP8"):        K("M-Shift-Super-Up"),          # (fix_numpad_nav_keys) 
    K("M-Shift-RC-KP2"):        K("M-Shift-Super-Down"),        # (fix_numpad_nav_keys) 
    K("M-Shift-RC-KP4"):        K("M-Shift-Super-Left"),        # (fix_numpad_nav_keys) 
    K("M-Shift-RC-KP6"):        K("M-Shift-Super-Right"),       # (fix_numpad_nav_keys) 

    ###  Keypad keys with 4 modifier keys
    K("LC-M-Shift-RC-KP9"):     K("C-M-Shift-Super-Page_Up"),   # (fix_numpad_nav_keys) 
    K("LC-M-Shift-RC-KP3"):     K("C-M-Shift-Super-Page_Down"), # (fix_numpad_nav_keys) 
    K("LC-M-Shift-RC-KP7"):     K("C-M-Shift-Super-Home"),      # (fix_numpad_nav_keys) 
    K("LC-M-Shift-RC-KP1"):     K("C-M-Shift-Super-End"),       # (fix_numpad_nav_keys) 
    K("LC-M-Shift-RC-KP8"):     K("C-M-Shift-Super-Up"),        # (fix_numpad_nav_keys) 
    K("LC-M-Shift-RC-KP2"):     K("C-M-Shift-Super-Down"),      # (fix_numpad_nav_keys) 
    K("LC-M-Shift-RC-KP4"):     K("C-M-Shift-Super-Left"),      # (fix_numpad_nav_keys) 
    K("LC-M-Shift-RC-KP6"):     K("C-M-Shift-Super-Right"),     # (fix_numpad_nav_keys) 

    ###========================================================================================================
    ###  END OF NUMERIC KEYPAD REMAPPING FIXES
    ###########################################################################################################
RedBearAK commented 3 years ago

From the Apple Human Interface Guidelines (HIG): https://developer.apple.com/design/human-interface-guidelines/macos/user-interaction/keyboard/

List modifier keys in the correct order. 
If you use more than one modifier key in a shortcut, always list them in this order: 
Control, Option, Shift, Command.

I'll be reworking the code with this in mind. It makes the most sense to me to put things in the order that corresponds most closely to the same Mac physical keys after Kinto's modifier remapping:

General GUI (not in terminals):

Ctrl, Option/Alt, Shift, Command == Super, M, Shift, RC

(Order on right side of mapping function: C, M, Shift, Super)

# 1 key
Super
M
Shift
RC

# 2 keys
Super-M
Super-Shift
Super-RC
M-Shift
M-RC
Shift-RC

# 3 keys
Super-M-Shift
Super-M-RC
Super-Shift-RC
M-Shift-RC

# 4 keys
Super-M-Shift-RC

For terminals:

Ctrl, Option/Alt, Shift, Command == LC, M, Shift, RC (for terminals)

(Order on right side of mapping function: C, M, Shift, Super)

# 1 key
LC
Shift
M
RC

# 2 keys
LC-M
LC-Shift
LC-RC
M-Shift
M-RC
Shift-RC

# 3 keys
LC-M-Shift
LC-M-RC
LC-Shift-RC
M-Shift-RC

# 4 keys
LC-M-Shift-RC

There are a total of 15 different modifier key combinations. All are now covered in the code in the first comment.

RedBearAK commented 3 years ago

@rbreaves

I think the "keypad and media key fixes" in the first post is in its final stages of revision. I actually can't think of anything to change at the moment.

I went to the trouble of lining up not just the comments at the end of each line but also the output side of the K function. Makes it much cleaner and easy to read, easier to see mistakes. The extra whitespace doesn't seem to cause any problems.

Look it over if you have a moment sometime and let me know if you see anything really dumb or potentially harmful.

If you can't see anything horribly wrong with it, I think I'm about ready to put this in a PR. It's working for me, as well as I've been able to test it. Even makes xfce4-terminal and gnome-terminal behave.

As far as I know, as long as the base key lines are kept disabled, this should cause no problems for anyone. Most people would never attempt to use separate dedicated media keys for anything but the media functions, so unless they have a weird keyboard like mine where they try to use the "media key" arrows as PgUp/PgDn/Home/End when used with modifiers, they should never encounter those shortcuts at all. But when I do use modifiers, my funky media key arrows now behave as if it was a MacBook.

The keypad still acts as a number pad when no modifiers are used and Numlock is on. The media keys, whether they are on the arrows and activated with Fn or dedicated keys elsewhere on the keyboard, still act as expected like media keys when used with no modifiers. So, it's almost like this doesn't exist unless you need it.

joshgoebel commented 2 years ago

f there isn't a smarter or more compact way to do this

Just use a loop to build the keymap object... It's just a python dict, nothing magical.

RedBearAK commented 2 years ago

@joshgoebel

Just use a loop to build the keymap object... It's just a python dict, nothing magical.

Sounds great. If I had a single working example I'm sure I could finally understand and run with it.

From examples online I see that the format is basically the same as every define_keymap and such throughout the config file, so they are all dictionaries already. But beyond that I can't see how to put together the loop you're describing to simplify this.

But I will look for more examples to see if I can figure it out.

joshgoebel commented 2 years ago

It should just be a nested loop and some fstrings:

map = {}
for combo in mod_combos:
    for numpad_key, output_key in keypad_keys.items():
       # build sttings
       map[K(inkeys)] = K(outkeys)
RedBearAK commented 2 years ago

@joshgoebel

I did this yesterday, as an experiment. Probably not nearly as simple as what you're thinking, but I was able to use a couple of similar loops to at least create a printed output that actually looked like the contents of the original keymap. So I consider that progress.

test-python-dict-zip-list-loop (copy).txt

I suspect the lists I came up with are not properly constructed to work with your example using map. Will look into how that works.

joshgoebel commented 2 years ago

Forward progress... I show you things to give you ideas, they aren't necessarily cut and paste able (as is)...

But map is a dict, eventually you need a dict to pass to the *map functions... so you're going to have to build that and set each key one by one with something similar to the code I showed you. You may want to read up more on Python in general, it's data structures, etc...