From 3234b0e521cca006a94cb135a88d146122d7f66d Mon Sep 17 00:00:00 2001 From: Arthur Williams Date: Mon, 20 Sep 2021 11:17:35 +0600 Subject: [PATCH] Allow any set of modifiers to be used in keybindings Previous the code only allowed ShiftMask,ControlMask or Mod1Mask to be used in keybindings and the presence of any others modifiers would be ignored. Most problems generally allow certain modifiers to be be ignored but not most and certainly don't allow Super-A to be treated like A. Now users can use any modifiers they want in keybindings and can also ignore any modifiers they want. By default only ModMask2 (commonly numlock is ignored) Co-authored-by: N-R-K <79544946+N-R-K@users.noreply.github.com> --- config.def.h | 3 +++ main.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config.def.h b/config.def.h index dfc94e1..0c09c4d 100644 --- a/config.def.h +++ b/config.def.h @@ -67,6 +67,9 @@ static const int THUMB_SIZE = 3; #endif #ifdef _MAPPINGS_CONFIG +/* Following modifiers (NumLock | CapsLock) will be ignored when processing keybindings */ +static const int ignore_mask = Mod2Mask | LockMask; + /* keyboard mappings for image and thumbnail mode: */ static const keymap_t keys[] = { /* modifiers key function argument */ diff --git a/main.c b/main.c index 52062ca..7c58594 100644 --- a/main.c +++ b/main.c @@ -566,7 +566,7 @@ end: redraw(); } -#define MODMASK(mask) ((mask) & (ShiftMask|ControlMask|Mod1Mask)) +#define MODMASK(mask) ((mask) & ~ignore_mask) void on_keypress(XKeyEvent *kev) {