feat(menu): dimmed keybind hints on menu rows (item 28c)
All checks were successful
Check / eval (push) Successful in 3m1s

The audit flagged the root picker as six short rows in ~760px of
empty width; the space now carries discoverability. menuHint renders
a dimmed pango span (size small, 55% alpha) from the SAME keybinds.nix
the Hyprland binds and the SUPER+? cheatsheet come from (prettyKeys),
so hints can never drift. Applied to the root picker (Apps special-
cased — it's rofi drun), all Tools leaves, and the System rows with
direct binds; those menus pass -markup-rows. Contains-glob matching
and the exact "↩ Back" row are unaffected.

Verified: V0; V1 (rendered menu bash -n, spans + 3x -markup-rows
present); visual — tokyo-night 1080p capture shows the hints dimmed
and subordinate on normal and selected rows alike.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-07-05 20:36:04 +01:00
parent 8874a22a37
commit 8f2e047f4a
3 changed files with 54 additions and 22 deletions

View File

@@ -129,6 +129,17 @@ let
cheatsheetFile = pkgs.writeText "nomarchy-keybinds.txt"
(lib.concatStringsSep "\n" cheatRows + "\n");
# Dimmed keybind hints on menu rows (item 28c) — the same keybinds.nix
# + prettyKeys the cheatsheet uses, so they can never drift from the
# live binds. Pango spans; the menus that show them pass -markup-rows.
# Empty (no hint) when a module has no direct bind.
menuHint = module:
let m = lib.filter (b: b.action == "exec, nomarchy-menu ${module}") keybinds.binds;
in lib.optionalString (m != [ ])
" <span size='small' alpha='55%'>${prettyKeys (lib.head m)}</span>";
# Apps opens rofi drun directly, not a nomarchy-menu module.
appsHint = " <span size='small' alpha='55%'>SUPER + D</span>";
nomarchy-menu = pkgs.writeShellScriptBin "nomarchy-menu" ''
# Nomarchy menu dispatcher thin presentation layer over
# `rofi -dmenu`; actions delegate to nomarchy-theme-sync, systemctl,
@@ -552,16 +563,16 @@ ${themeRows}
# Tools submenu utilities you invoke. Each leaf is also reachable
# directly (SUPER+CTRL+<mnemonic>); this just keeps the root short.
choice=$( {
row "Calculator" accessories-calculator
row "Clipboard" edit-paste
row "Emoji" face-smile-big
row "Files" system-file-manager
row "Web search" system-search
row "Capture" applets-screenshooter
command -v hyprpicker >/dev/null 2>&1 && row "Color picker" preferences-desktop-color
row "Ask Claude" internet-chat
row "Calculator${menuHint "calc"}" accessories-calculator
row "Clipboard${menuHint "clipboard"}" edit-paste
row "Emoji${menuHint "emoji"}" face-smile-big
row "Files${menuHint "files"}" system-file-manager
row "Web search${menuHint "web"}" system-search
row "Capture${menuHint "capture"}" applets-screenshooter
command -v hyprpicker >/dev/null 2>&1 && row "Color picker${menuHint "colorpicker"}" preferences-desktop-color
row "Ask Claude${menuHint "ask"}" internet-chat
back
} | rofi -dmenu -show-icons -p Tools) || exit 0
} | rofi -dmenu -show-icons -markup-rows -p Tools) || exit 0
case "$choice" in
"$BACK") exec "$0" ;;
*Calc*) exec "$0" calc ;;
@@ -580,14 +591,14 @@ ${themeRows}
# the submenu shrinks to match the hardware, like the Waybar modules.
bats=(/sys/class/power_supply/BAT*)
choice=$( {
row "Network" network-wireless
row "Network${menuHint "network"}" network-wireless
row "VPN" network-vpn
row "Bluetooth" bluetooth
row "Bluetooth${menuHint "bluetooth"}" bluetooth
[ -e "''${XDG_RUNTIME_DIR:-/run/user/$(id -u)}/pulse/native" ] \
&& row "Audio" audio-volume-high
row "Display" video-display
command -v system-config-printer >/dev/null 2>&1 && row "Printers" printer
row "Do Not Disturb" notification-disabled
row "Do Not Disturb${menuHint "dnd"}" notification-disabled
if systemctl --user is-active --quiet hyprsunset.service 2>/dev/null
then row "Night light (on)" weather-clear-night
else row "Night light (off)" weather-clear-night
@@ -609,7 +620,7 @@ ${themeRows}
row "Power profile" preferences-system-power
fi
back
} | rofi -dmenu -show-icons -p System) || exit 0
} | rofi -dmenu -show-icons -markup-rows -p System) || exit 0
case "$choice" in
"$BACK") exec "$0" ;;
*Network*) exec "$0" network ;;
@@ -633,13 +644,13 @@ ${themeRows}
# short and scannable. Apps/Theme/Power/Keybindings are frequent enough
# to keep at the top; everything else lives under Tools or System.
choice=$( {
row "Apps" applications-all
row "Theme" preferences-desktop-theme
row "Apps${appsHint}" applications-all
row "Theme${menuHint "theme"}" preferences-desktop-theme
row "Tools" applications-utilities
row "System" preferences-system
row "Power" system-shutdown
row "Keybindings" preferences-desktop-keyboard
} | rofi -dmenu -show-icons -p Menu) || exit 0
row "Power${menuHint "power"}" system-shutdown
row "Keybindings${menuHint "keybinds"}" preferences-desktop-keyboard
} | rofi -dmenu -show-icons -markup-rows -p Menu) || exit 0
case "$choice" in
*Apps*) exec rofi -show drun ;;
*Theme*) exec "$0" theme ;;