feat(menu): group keybinds cheatsheet Window/Workspace/Menu/Media (#108)
All checks were successful
Check / eval (push) Successful in 3m39s

Every bind in keybinds.nix carries a group; SUPER+? renders section
headers. checks.keybinds-cheatsheet asserts all groups are valid and
every description appears in the sheet (same source as Hyprland binds).

Verified: V0 flake check; built cheatsheet shows ── Window ── / etc.
This commit is contained in:
2026-07-15 10:04:33 +01:00
parent e6be5a5770
commit be2d0d200b
6 changed files with 131 additions and 61 deletions

View File

@@ -133,17 +133,37 @@ let
# renders "SHIFT + /". `?` IS Shift+/, so collapse that back to the
# single documented glyph — the cheatsheet reads "SUPER + ?".
in lib.replaceStrings [ "SHIFT + /" ] [ "?" ] (prefix + key);
cheatRows =
map (b: padRight 22 (prettyKeys b) + b.desc) (keybinds.binds
# Grouped cheatsheet (#108): Window → Workspace → Menu → Media.
# Section headers are non-selectable chrome (rofi still shows them as rows;
# Enter is a no-op either way). Order matches the group enum.
cheatGroupOrder = [ "Window" "Workspace" "Menu" "Media" ];
cheatBindRows =
map (b: {
inherit (b) group desc;
keys = prettyKeys b;
}) (keybinds.binds
++ lib.optionals (lib.hasInfix "," cfg.keyboard.layout)
keybinds.multiLayoutBinds)
# Launch-or-focus binds (nomarchy.launchOrFocus, generated in
# hyprland.nix) — same renderer, so they land in the cheatsheet too.
++ map (e: padRight 22 (prettyKeys e)
+ (if e.desc != "" then e.desc
else "Focus or launch ${if e.command == "" then lib.toLower e.class else e.command}"))
cfg.launchOrFocus
++ map (e: padRight 22 e.keys + e.desc) keybinds.extra;
++ map (e: {
group = "Menu";
keys = prettyKeys e;
desc = if e.desc != "" then e.desc
else "Focus or launch ${if e.command == "" then lib.toLower e.class else e.command}";
}) cfg.launchOrFocus
++ map (e: {
group = e.group or "Menu";
keys = e.keys;
inherit (e) desc;
}) keybinds.extra;
cheatRowsFor = g:
let rows = lib.filter (r: r.group == g) cheatBindRows;
in lib.optionals (rows != [ ]) (
[ (" " + g + " ") ]
++ map (r: padRight 22 r.keys + r.desc) rows
);
cheatRows = lib.concatLists (map cheatRowsFor cheatGroupOrder);
cheatsheetFile = pkgs.writeText "nomarchy-keybinds.txt"
(lib.concatStringsSep "\n" cheatRows + "\n");