aboutsummaryrefslogtreecommitdiffstats
path: root/keybinds/test_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/test_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/test_binds.js')
-rw-r--r--keybinds/test_binds.js20
1 files changed, 12 insertions, 8 deletions
diff --git a/keybinds/test_binds.js b/keybinds/test_binds.js
index 81f9108..9acb071 100644
--- a/keybinds/test_binds.js
+++ b/keybinds/test_binds.js
@@ -21,10 +21,14 @@ const src = fs.readFileSync(__dirname + "/Binds.js", "utf8")
const B = new Function(src + "\nreturn { mods, keys, group };")();
assert.deepStrictEqual(B.mods(0), []);
-assert.deepStrictEqual(B.mods(65), ["SUPER", "SHIFT"]);
+assert.deepStrictEqual(B.mods(65), ["Win", "SHIFT"]);
assert.deepStrictEqual(B.mods(13), ["CTRL", "ALT", "SHIFT"]);
-assert.strictEqual(B.keys({ modmask: 69, key: "F1" }), "SUPER + CTRL + SHIFT + F1");
-assert.strictEqual(B.keys({ modmask: 0, key: "XF86AudioMute" }), "XF86AudioMute");
+assert.strictEqual(B.keys({ modmask: 69, key: "F1" }), "Win + CTRL + SHIFT + F1");
+assert.strictEqual(B.keys({ modmask: 0, key: "XF86AudioMute" }), "Mute");
+assert.strictEqual(B.keys({ modmask: 64, key: "mouse:272" }), "Win + LMB");
+assert.strictEqual(B.keys({ modmask: 0, key: "F5" }), "F5");
+// A key named like an Object.prototype member is not renamed.
+assert.strictEqual(B.keys({ modmask: 0, key: "constructor" }), "constructor");
assert.deepStrictEqual(B.group([
{ modmask: 64, key: "s", description: "" },
@@ -34,18 +38,18 @@ assert.deepStrictEqual(B.group([
{ modmask: 8, key: "x", description: "No colon here" },
]), [
{ name: "Apps", rows: [
- { keys: "SUPER + w", label: "Browser" },
- { keys: "SUPER + e", label: "Files" },
+ { keys: "Win + w", label: "Browser" },
+ { keys: "Win + e", label: "Files" },
] },
- { name: "Media", rows: [{ keys: "XF86AudioMute", label: "Mute" }] },
+ { name: "Media", rows: [{ keys: "Mute", label: "Mute" }] },
{ name: "Other", rows: [{ keys: "ALT + x", label: "No colon here" }] },
- { name: "Undescribed", rows: [{ keys: "SUPER + s", label: "no description" }] },
+ { name: "Undescribed", rows: [{ keys: "Win + s", label: "no description" }] },
]);
// A group name matching an Object.prototype property must not resolve to
// the inherited value instead of creating a new group.
assert.deepStrictEqual(B.group([
{ modmask: 64, key: "z", description: "toString: Weird" },
-]), [{ name: "toString", rows: [{ keys: "SUPER + z", label: "Weird" }] }]);
+]), [{ name: "toString", rows: [{ keys: "Win + z", label: "Weird" }] }]);
console.log("ok");