diff --git a/README.md b/README.md index 8decbe2..56de55a 100644 --- a/README.md +++ b/README.md @@ -110,27 +110,6 @@ like `MAOMAOCONFIG=/home/xxx/maomao` - the fallback config path is in `/etc/maomao/config.conf`, you can find the default config here -# keybinds notice - -All mod keys(alt,ctrl,shift,super,none) are case insensitive, in addition to other key names are case sensitive, the name follows the xkb standard name, you can use the `xev` command to get the key name of the key you want, note that if your mod key contains the shift key, then it may not be the key name displayed on the keyboard. Real name Refer to the name displayed in the `xev` command. - -for example: - -### this is wrong: - -``` -bind=alt+shift,2,quit -``` - -### this is right: - -``` -bind=alt+shift,at,quit -``` - -because your keybinds contain shift, the `2` cover to `at` -![swappy-20250227-182157](https://github.com/user-attachments/assets/c4bca146-d1d7-42b1-aea5-a7e7e19e874b) - # custom animation ``` diff --git a/config.conf b/config.conf index 1efdf4e..678ab62 100644 --- a/config.conf +++ b/config.conf @@ -157,10 +157,7 @@ tags=id:9,layout_name:tile # monitorrule=HDMI-A-1,0.55,1,tile,0,1,1920,0 # Key Bindings -# The mod key is not case sensitive, -# but the second key is case sensitive, -# if you use shift as one of the mod keys, -# remember to use uppercase keys +# All keys is not case sensitive, # mod keys name: super,ctrl,alt,shift,none diff --git a/src/maomao.c b/src/maomao.c index ea6f611..61fcc5c 100644 --- a/src/maomao.c +++ b/src/maomao.c @@ -3716,7 +3716,7 @@ keybinding(uint32_t mods, xkb_keysym_t sym) { if (config.key_bindings_count < 1) break; k = &config.key_bindings[ji]; - if (CLEANMASK(mods) == CLEANMASK(k->mod) && sym == k->keysym && k->func) { + if (CLEANMASK(mods) == CLEANMASK(k->mod) && xkb_keysym_to_upper(sym) == k->keysym && k->func) { k->func(&k->arg); handled = 1; } diff --git a/src/parse_config.h b/src/parse_config.h index 8f5b0a7..b8a06c5 100644 --- a/src/parse_config.h +++ b/src/parse_config.h @@ -299,7 +299,7 @@ uint32_t parse_mod(const char *mod_str) { } xkb_keysym_t parse_keysym(const char *keysym_str) { - return xkb_keysym_from_name(keysym_str, XKB_KEYSYM_NO_FLAGS); + return xkb_keysym_to_upper(xkb_keysym_from_name(keysym_str, XKB_KEYSYM_NO_FLAGS)); } int parse_button(const char *str) {