aboutsummaryrefslogtreecommitdiffstats
path: root/keybinds/Binds.js
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-25 19:47:35 +0200
committerDanilo M. <danix@danix.xyz>2026-09-25 19:47:35 +0200
commita7725f296102a6f4f69d4488a0b94f3b0f337471 (patch)
tree30fd1cb8a2e4841ce6f5fe446174cab43867caa7 /keybinds/Binds.js
parente27764e4d00c0e3dead711689c5a598b91ce6256 (diff)
downloadquickshell-a7725f296102a6f4f69d4488a0b94f3b0f337471.tar.gz
quickshell-a7725f296102a6f4f69d4488a0b94f3b0f337471.zip
feat(keybinds): show mnemonic names for obscure keys
Hyprland's key names are its own (mouse:272, XF86Calculator), not what is printed on the keyboard or how the key is pressed, which defeats a reminder. A fixed map in Binds.js renames them for display only; an unlisted key shows as before. SUPER reads as Win for the same reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'keybinds/Binds.js')
-rw-r--r--keybinds/Binds.js24
1 files changed, 22 insertions, 2 deletions
diff --git a/keybinds/Binds.js b/keybinds/Binds.js
index 697f3c9..2029f36 100644
--- a/keybinds/Binds.js
+++ b/keybinds/Binds.js
@@ -16,14 +16,34 @@
// Modmask bits, in the order they are written in keybindings.lua.
// ponytail: CAPS/MOD2/MOD3/MOD5 bits are not decoded and vanish from the
// combo; add them here if a bind ever uses one.
-const MODS = [[64, "SUPER"], [4, "CTRL"], [8, "ALT"], [1, "SHIFT"]];
+// SUPER shows as Win, the key it is on.
+const MODS = [[64, "Win"], [4, "CTRL"], [8, "ALT"], [1, "SHIFT"]];
function mods(mask) {
return MODS.filter(m => mask & m[0]).map(m => m[1]);
}
+// Display names for keys whose Hyprland name is hard to remember. A key not
+// listed shows as Hyprland names it. The Fn combos are where the XF86 keys
+// sit on this keyboard, which is how they are pressed.
+const NAMES = Object.assign(Object.create(null), {
+ "mouse:272": "LMB",
+ "mouse:273": "RMB",
+ "mouse_up": "Mouse wheel up",
+ "mouse_down": "Mouse wheel down",
+ "XF86AudioRaiseVolume": "Volume +",
+ "XF86AudioLowerVolume": "Volume -",
+ "XF86AudioMute": "Mute",
+ "XF86AudioPlay": "Play/Pause",
+ "XF86AudioPrev": "Previous song",
+ "XF86AudioNext": "Next song",
+ "XF86Calculator": "Fn+F9",
+ "XF86Mail": "Fn+F10",
+ "XF86Search": "Fn+F11",
+});
+
function keys(bind) {
- return mods(bind.modmask).concat([bind.key]).join(" + ");
+ return mods(bind.modmask).concat([NAMES[bind.key] ?? bind.key]).join(" + ");
}
// A description reads "Group: Label". A bind without one still shows, last,