Krolyxon
Commit 3234b0e

Branches

Refs →

nsxiv3234b0e

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)
Author
Arthur Williams
Date
2021-09-20 11:17 +0600
Committer
NRK · 2021-09-20 11:17 +0600
Parent
24e70a9
Commit
3234b0e521cca006a94cb135a88d146122d7f66d

+4 −1

2 files changed

  1. M config.def.h +3 −0
  2. M main.c +1 −1
M config.def.h View
@@ -67,6 +67,9 @@ static const int THUMB_SIZE = 3;
6767 #endif
6868 #ifdef _MAPPINGS_CONFIG
6969
70+/* Following modifiers (NumLock | CapsLock) will be ignored when processing keybindings */
71+static const int ignore_mask = Mod2Mask | LockMask;
72+
7073 /* keyboard mappings for image and thumbnail mode: */
7174 static const keymap_t keys[] = {
7275 /* modifiers key function argument */
M main.c View
@@ -566,7 +566,7 @@ end:
566566 redraw();
567567 }
568568
569−#define MODMASK(mask) ((mask) & (ShiftMask|ControlMask|Mod1Mask))
569+#define MODMASK(mask) ((mask) & ~ignore_mask)
570570
571571 void on_keypress(XKeyEvent *kev)
572572 {