mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-18 09:05:24 -04:00
fix(keybinds): record numpad keys as KP_* keysyms (#2645)
* fix(keybinds): record numpad keys as KP_* keysyms The shortcut recorder passed only the Qt key code to xkbKeyFromQtKey and dropped Qt.KeypadModifier. Since Qt reuses the same Qt::Key_* values for the numpad and the main row / nav cluster, numpad presses collapsed onto their twins: numpad-7 became "7" (NumLock on) or "Home" (NumLock off) instead of "KP_7"/"KP_Home", numpad-+ became "Equal", numpad-* became "8", numpad Enter became "Return". numpad-5 with NumLock off (Qt.Key_Clear) was missing from the map entirely, so the capture was silently dropped. niri and the other providers bind against the xkb KP_* keysym names, so these tokens never matched the physical key. Pass the keypad flag through to xkbKeyFromQtKey and map keypad presses to the KP_* keysyms: KP_0..KP_9 for the NumLock-on digit codes, the navigation names (KP_Home, KP_End, KP_Up, ...) for the NumLock-off codes, plus the operators and KP_Enter. Main-row keys are unaffected because they never carry the keypad modifier. * fix(keybinds): ignore lock keys while capturing a shortcut NumLock/CapsLock/ScrollLock are toggles, not useful bind targets. Pressing NumLock to switch the numpad between its digit and navigation keysyms (KP_7 vs KP_Home) was captured as the bind itself (e.g. "Super+Num_Lock"). Skip them in the recorder like the other pure modifier keys already are.
This commit is contained in:
@@ -698,6 +698,12 @@ Item {
|
||||
case Qt.Key_Shift:
|
||||
case Qt.Key_Alt:
|
||||
case Qt.Key_Meta:
|
||||
// Lock keys are toggles, not useful bind targets; ignore
|
||||
// them so toggling NumLock to pick the numpad keysym
|
||||
// (KP_7 vs KP_Home) doesn't get captured as the bind.
|
||||
case Qt.Key_NumLock:
|
||||
case Qt.Key_CapsLock:
|
||||
case Qt.Key_ScrollLock:
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -720,7 +726,7 @@ Item {
|
||||
mods.push("Shift");
|
||||
}
|
||||
|
||||
const key = KeyUtils.xkbKeyFromQtKey(qtKey);
|
||||
const key = KeyUtils.xkbKeyFromQtKey(qtKey, !!(event.modifiers & Qt.KeypadModifier));
|
||||
if (!key) {
|
||||
log.warn("Unknown key:", event.key, "mods:", event.modifiers);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user