feat(rofi): show the Print-key hints on the Capture menu rows
All checks were successful
Check / eval (push) Successful in 3m2s

Iteration #66 (direct request: "make sure menu items that have a keybind
display it"). Audit found every SUPER(+CTRL) module-opening row already
hinted (item 28c); the one gap was Tools ▸ Capture — its Region/Full
screen rows run the exact grim commands of the Print / SHIFT+Print /
CTRL+Print binds but showed nothing. Adds `hintForBind mods key` (matches
keybinds.nix by mods+key, so no drift and no brittle full-action compare)
and `-markup-rows` on the Capture menu so the spans render.

Verified: V0 green; V1 HM built — shipped nomarchy-menu shows
`Region → clipboard {{Print}}`, `Region → file {{SHIFT + Print}}`,
`Full screen → file {{CTRL + Print}}`. Substring case-matches precede the
appended span, so dispatch is unchanged. V3 (pango dim render) queued.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-07-08 14:16:45 +01:00
parent b18980f642
commit 714fbd1daf
3 changed files with 41 additions and 4 deletions

View File

@@ -158,6 +158,14 @@ let
menuHint = module: hintForAction "exec, nomarchy-menu ${module}";
# Apps opens rofi drun directly, not a nomarchy-menu module.
appsHint = " <span size='small' alpha='55%'>SUPER + D</span>";
# A menu row that runs the same op as a global bind whose action isn't a
# `nomarchy-menu` module (the Capture rows ↔ the Print screenshot keys):
# match on mods+key so the hint still reads from keybinds.nix (single
# source, no drift), rather than a brittle full-action-string compare.
hintForBind = mods: key:
let m = lib.filter (b: b.mods == mods && b.key == key) keybinds.binds;
in lib.optionalString (m != [ ])
" <span size='small' alpha='55%'>${prettyKeys (lib.head m)}</span>";
nomarchy-menu = pkgs.writeShellScriptBin "nomarchy-menu" ''
# Nomarchy menu dispatcher thin presentation layer over
@@ -400,10 +408,10 @@ ${themeRows}
# Screenshots + screen recording. Recording rows self-swap: while
# one runs, the only offer is Stop (same surface as the bar's ).
choice=$( {
row "Region clipboard" applets-screenshooter
row "Region file" applets-screenshooter
row "Region clipboard${hintForBind "" "Print"}" applets-screenshooter
row "Region file${hintForBind "SHIFT" "Print"}" applets-screenshooter
row "Full screen clipboard" camera-photo
row "Full screen file" camera-photo
row "Full screen file${hintForBind "CTRL" "Print"}" camera-photo
command -v tesseract >/dev/null 2>&1 && row "OCR region clipboard" scanner
if command -v nomarchy-record >/dev/null 2>&1; then
if nomarchy-record active; then
@@ -416,7 +424,7 @@ ${themeRows}
fi
fi
back
} | rofi -dmenu -show-icons -p Capture) || exit 0
} | rofi -dmenu -show-icons -markup-rows -p Capture) || exit 0
dir="$HOME/Pictures/Screenshots"
file="$dir/$(date +%Y%m%d-%H%M%S).png"
case "$choice" in