]> git.mdlowis.com Git - proto/labwc.git/commitdiff
keybinds: add support for Meta and Hyper modifiers
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Sun, 8 Oct 2023 17:24:35 +0000 (19:24 +0200)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Sun, 8 Oct 2023 19:11:32 +0000 (21:11 +0200)
The modifiers can be used in keybinds via M-key and H-key

Additionally adds support for:
- Mod1 (same as A)
- Mod3 (same as H)
- Mod4 (same as W)
- Mod5 (same as M)

This is compatible with the format used by Openbox.
(http://openbox.org/wiki/Help:Bindings#Syntax)

Mod2 (NumLock) and Caps are still not supported due to
their locking behavior but could theoretically be added.

Fixes: #1061
src/config/keybind.c
src/keyboard.c

index f741b2bdd085597412e6f385e41aa128cb1c79f4..1de02513b71c434d4ce3f7f7e749cc0bde077806 100644 (file)
 uint32_t
 parse_modifier(const char *symname)
 {
+       /* Mod2 == NumLock */
        if (!strcmp(symname, "S")) {
                return WLR_MODIFIER_SHIFT;
        } else if (!strcmp(symname, "C")) {
                return WLR_MODIFIER_CTRL;
-       } else if (!strcmp(symname, "A")) {
+       } else if (!strcmp(symname, "A") || !strcmp(symname, "Mod1")) {
                return WLR_MODIFIER_ALT;
-       } else if (!strcmp(symname, "W")) {
+       } else if (!strcmp(symname, "W") || !strcmp(symname, "Mod4")) {
                return WLR_MODIFIER_LOGO;
+       } else if (!strcmp(symname, "M") || !strcmp(symname, "Mod5")) {
+               return WLR_MODIFIER_MOD5;
+       } else if (!strcmp(symname, "H") || !strcmp(symname, "Mod3")) {
+               return WLR_MODIFIER_MOD3;
        } else {
                return 0;
        }
index 43c84755fd21715225b527f23a27e8c652e55a34..2b7051408c78ccc81ee97fe12966382891bc3eff 100644 (file)
@@ -130,7 +130,10 @@ static bool is_modifier_key(xkb_keysym_t sym)
                || sym == XKB_KEY_Control_L
                || sym == XKB_KEY_Control_R
                || sym == XKB_KEY_Super_L
-               || sym == XKB_KEY_Super_R;
+               || sym == XKB_KEY_Super_R
+               /* Right hand Alt key for Mod5 */
+               || sym == XKB_KEY_Mode_switch
+               || sym == XKB_KEY_ISO_Level3_Shift;
 }
 
 struct keysyms {