aboutsummaryrefslogtreecommitdiffstats
path: root/keybinds/Binds.js
diff options
context:
space:
mode:
Diffstat (limited to 'keybinds/Binds.js')
-rw-r--r--keybinds/Binds.js41
1 files changed, 40 insertions, 1 deletions
diff --git a/keybinds/Binds.js b/keybinds/Binds.js
index 2029f36..d02c714 100644
--- a/keybinds/Binds.js
+++ b/keybinds/Binds.js
@@ -46,6 +46,43 @@ function keys(bind) {
return mods(bind.modmask).concat([NAMES[bind.key] ?? bind.key]).join(" + ");
}
+// Where a bind sits on the macropad, keyed by the combo as keys() writes it,
+// so a renamed key above must be renamed here too. key is 1-12, left to
+// right and top to bottom; knob is the top or bottom encoder with how it is
+// turned; mod is what is held with it. The pad's firmware sends these combos.
+const PAD = Object.assign(Object.create(null), {
+ "Win + w": { key: 1 },
+ "Win + SHIFT + w": { key: 1, mod: "Shift" },
+ "Win + r": { key: 2 },
+ "Win + SHIFT + r": { key: 2, mod: "Shift" },
+ "Win + g": { key: 3 },
+ "CTRL + SHIFT + l": { key: 4 },
+ "CTRL + ALT + SHIFT + l": { key: 4, mod: "Alt" },
+ "ALT + Return": { key: 5 },
+ "ALT + SHIFT + Return": { key: 5, mod: "Shift" },
+ "ALT + h": { key: 6 },
+ "Win + CTRL + r": { key: 7 },
+ "ALT + w": { key: 8 },
+ "Volume -": { knob: "top", turn: "↺" },
+ "Volume +": { knob: "top", turn: "↻" },
+ "Mute": { knob: "top", turn: "●" },
+ "Win + Volume -": { knob: "top", turn: "↺", mod: "Win" },
+ "Win + Volume +": { knob: "top", turn: "↻", mod: "Win" },
+ "Previous song": { knob: "bottom", turn: "↺" },
+ "Next song": { knob: "bottom", turn: "↻" },
+ "Play/Pause": { knob: "bottom", turn: "●" },
+ "Win + Previous song": { knob: "bottom", turn: "↺", mod: "Win" },
+ "Win + Next song": { knob: "bottom", turn: "↻", mod: "Win" },
+});
+// The bottom row is workspaces 1-4, 5-8 with Shift, and moves the window
+// there with Win held on the keyboard.
+for (let i = 1; i <= 4; i++) {
+ PAD["CTRL + F" + i] = { key: 8 + i };
+ PAD["CTRL + SHIFT + F" + i] = { key: 8 + i, mod: "Shift" };
+ PAD["Win + CTRL + F" + i] = { key: 8 + i, mod: "Win" };
+ PAD["Win + CTRL + SHIFT + F" + i] = { key: 8 + i, mod: "Win Shift" };
+}
+
// A description reads "Group: Label". A bind without one still shows, last,
// so a gap in the config is visible rather than silently missing.
function group(binds) {
@@ -65,7 +102,9 @@ function group(binds) {
byName[name] = { name: name, rows: [] };
groups.push(byName[name]);
}
- byName[name].rows.push({ keys: keys(b), label: label });
+ const row = { keys: keys(b), label: label };
+ if (PAD[row.keys]) row.pad = PAD[row.keys];
+ byName[name].rows.push(row);
}
if (undescribed.length) groups.push({ name: "Undescribed", rows: undescribed });
return groups;