aboutsummaryrefslogtreecommitdiffstats
path: root/keybinds/test_binds.js
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-25 20:05:27 +0200
committerDanilo M. <danix@danix.xyz>2026-09-25 20:05:27 +0200
commit85206cf2939109b2b28044b35b37be510ad2b3fa (patch)
tree1f6544bb28ab2e7b8c401a22dbee73d524f04d53 /keybinds/test_binds.js
parenta7725f296102a6f4f69d4488a0b94f3b0f337471 (diff)
downloadquickshell-85206cf2939109b2b28044b35b37be510ad2b3fa.tar.gz
quickshell-85206cf2939109b2b28044b35b37be510ad2b3fa.zip
feat(keybinds): show where a bind sits on the macropad
The macropad's firmware sends ordinary combos, so the overlay listed them as keyboard shortcuts nobody presses. A PAD table in Binds.js maps each combo to its key (1-12) or encoder (top or bottom, turned or pressed) and what is held with it, and the row draws the pad small with that key lit. The workspace row is built in a loop, as it is in keybindings.lua. Every entry was checked against hyprctl binds -j. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'keybinds/test_binds.js')
-rw-r--r--keybinds/test_binds.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/keybinds/test_binds.js b/keybinds/test_binds.js
index 9acb071..08be66a 100644
--- a/keybinds/test_binds.js
+++ b/keybinds/test_binds.js
@@ -18,7 +18,7 @@ const assert = require("assert");
const src = fs.readFileSync(__dirname + "/Binds.js", "utf8")
.replace(/^\.pragma library$/m, "");
-const B = new Function(src + "\nreturn { mods, keys, group };")();
+const B = new Function(src + "\nreturn { mods, keys, group, PAD };")();
assert.deepStrictEqual(B.mods(0), []);
assert.deepStrictEqual(B.mods(65), ["Win", "SHIFT"]);
@@ -38,10 +38,10 @@ assert.deepStrictEqual(B.group([
{ modmask: 8, key: "x", description: "No colon here" },
]), [
{ name: "Apps", rows: [
- { keys: "Win + w", label: "Browser" },
+ { keys: "Win + w", label: "Browser", pad: { key: 1 } },
{ keys: "Win + e", label: "Files" },
] },
- { name: "Media", rows: [{ keys: "Mute", label: "Mute" }] },
+ { name: "Media", rows: [{ keys: "Mute", label: "Mute", pad: { knob: "top", turn: "●" } }] },
{ name: "Other", rows: [{ keys: "ALT + x", label: "No colon here" }] },
{ name: "Undescribed", rows: [{ keys: "Win + s", label: "no description" }] },
]);
@@ -52,4 +52,13 @@ assert.deepStrictEqual(B.group([
{ modmask: 64, key: "z", description: "toString: Weird" },
]), [{ name: "toString", rows: [{ keys: "Win + z", label: "Weird" }] }]);
+// The macropad: shifted keys, the workspace row built in a loop, and an
+// encoder turned with Win held.
+assert.deepStrictEqual(B.PAD["Win + SHIFT + r"], { key: 2, mod: "Shift" });
+assert.deepStrictEqual(B.PAD["CTRL + ALT + SHIFT + l"], { key: 4, mod: "Alt" });
+assert.deepStrictEqual(B.PAD["CTRL + F1"], { key: 9 });
+assert.deepStrictEqual(B.PAD["Win + CTRL + SHIFT + F4"], { key: 12, mod: "Win Shift" });
+assert.deepStrictEqual(B.PAD["Win + Previous song"], { knob: "bottom", turn: "↺", mod: "Win" });
+assert.strictEqual(B.PAD["toString"], undefined);
+
console.log("ok");