feat(menu): group the rofi picker into Tools / System submenus

The root picker had grown to 16 flat entries. Collapse it to six —
Apps · Theme · Tools › · System › · Power · Keybindings — with Tools
(Calculator, Clipboard, Emoji, Files, Web, Capture, Ask) and System
(Network, Bluetooth, DND, plus the self-gated Snapshots / Power-profile)
as submenus the dispatcher routes via `nomarchy-menu tools|system`. Each
submenu ends in a ← Back entry that re-opens the root. The direct
SUPER+CTRL+<mnemonic> binds still reach the leaves straight (bypassing
the menu), and the gated entries still hide when unavailable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-06-16 17:35:03 +01:00
parent f68b245d92
commit e0ee5b9e7e
2 changed files with 67 additions and 42 deletions

View File

@@ -37,15 +37,16 @@ how to override it. Items marked ✓ are shipped.
launcher, no second theming pipeline; the dispatcher owns the menu launcher, no second theming pipeline; the dispatcher owns the menu
structure, so the renderer stays swappable (we moved fuzzel → rofi 2.0 structure, so the renderer stays swappable (we moved fuzzel → rofi 2.0
once mainline gained native Wayland, for its richer theming) once mainline gained native Wayland, for its richer theming)
- **Organize the picker into category submenus:** the root picker has grown - **Organize the picker into category submenus:** the root picker had grown
into a long flat list (Apps · Theme · Clipboard · Calculator · Files · into a long flat list of 16 entries. It's now six: **Apps · Theme · Tools
Emoji · Web · Network · Bluetooth · Capture · Keybindings · Ask · DND · · System · Power · Keybindings**. `Tools` (Calculator, Clipboard, Emoji,
Snapshots · Power profile · Power · …). Group it into category submenus Files, Web, Capture, Ask) and `System` (Network, Bluetooth, DND, and the
(e.g. **System**, **Tools**, **Look & Feel**, **Power**) so the top level self-gated Snapshots / Power-profile) are submenus the dispatcher routes via
stays short and scannable, the dispatcher routing `nomarchy-menu <category>` `nomarchy-menu tools|system`, each ending in a `← Back` entry that re-opens
→ its leaf modules. Keep the direct `SUPER+CTRL+<mnemonic>` binds as fast the root. The direct `SUPER+CTRL+<mnemonic>` binds still hit the leaves
paths straight to the leaves (they bypass the menu), and self-gated straight (bypassing the menu), and the self-gated entries still hide when
entries (power-profile, snapshots) still hide when unavailable. unavailable. Remaining (optional): a **Look & Feel** category once there are
more appearance toggles to group with Theme (night-light, wallpaper).
-**Menu modules from rofi plugins:** the old `calc` flow committed the -**Menu modules from rofi plugins:** the old `calc` flow committed the
expression blind (result only in the *next* menu's `-mesg`) and `qalc -t` expression blind (result only in the *next* menu's `-mesg`) and `qalc -t`
misparsed common phrasings (`15% of 200``rem(15, 1 B)`, the natural- misparsed common phrasings (`15% of 200``rem(15, 1 B)`, the natural-

View File

@@ -180,54 +180,78 @@ let
|| { notify-send "Snapshots" "btrfs-assistant isn't installed (BTRFS snapshots off?)."; exit 0; } || { notify-send "Snapshots" "btrfs-assistant isn't installed (BTRFS snapshots off?)."; exit 0; }
exec btrfs-assistant ;; exec btrfs-assistant ;;
"") tools)
# Tools submenu utilities you invoke. Each leaf is also reachable
# directly (SUPER+CTRL+<mnemonic>); this just keeps the root short.
choice=$(printf '%s\n' \
"󰃬 Calculator" \
"󰅌 Clipboard" \
"󰒨 Emoji" \
"󰈞 Files" \
"󰖟 Web search" \
"󰄄 Capture" \
"󰭹 Ask Claude" \
"󰁍 Back" \
| rofi -dmenu -p tools) || exit 0
case "$choice" in
*Calc*) exec "$0" calc ;;
*Clipboard*) exec "$0" clipboard ;;
*Emoji*) exec "$0" emoji ;;
*Files*) exec "$0" files ;;
*Web*) exec "$0" web ;;
*Capture*) exec "$0" capture ;;
*Ask*) exec "$0" ask ;;
*Back*) exec "$0" ;;
esac ;;
system)
# System submenu connectivity and machine state. Snapshots and the
# power-profile picker self-gate (BTRFS+snapper / laptop on ppd), so
# the submenu shrinks to match the hardware, like the Waybar modules.
entries=( entries=(
"󰀻 Apps"
"󰏘 Theme"
"󰅌 Clipboard"
"󰃬 Calculator"
"󰈞 Files"
"󰒨 Emoji"
"󰖟 Web search"
"󰖩 Network" "󰖩 Network"
"󰂯 Bluetooth" "󰂯 Bluetooth"
"󰄄 Capture"
"󰋖 Keybindings"
"󰭹 Ask Claude"
"󰂛 Do Not Disturb" "󰂛 Do Not Disturb"
) )
# Snapshots only when btrfs-assistant is installed (BTRFS + snapper).
command -v btrfs-assistant >/dev/null 2>&1 && entries+=("󰋚 Snapshots") command -v btrfs-assistant >/dev/null 2>&1 && entries+=("󰋚 Snapshots")
# Power-profile picker only when this is a laptop (battery present)
# running power-profiles-daemon matches the Waybar indicator's
# self-gating; desktops and the TLP backend don't show it.
bats=(/sys/class/power_supply/BAT*) bats=(/sys/class/power_supply/BAT*)
if [ -e "''${bats[0]}" ] && command -v powerprofilesctl >/dev/null 2>&1; then if [ -e "''${bats[0]}" ] && command -v powerprofilesctl >/dev/null 2>&1; then
entries+=("󰓅 Power profile") entries+=("󰓅 Power profile")
fi fi
entries+=("󰐥 Power") entries+=("󰁍 Back")
choice=$(printf '%s\n' "''${entries[@]}" | rofi -dmenu -p menu) || exit 0 choice=$(printf '%s\n' "''${entries[@]}" | rofi -dmenu -p system) || exit 0
case "$choice" in case "$choice" in
*Apps*) exec rofi -show drun ;; *Network*) exec "$0" network ;;
*Theme*) exec "$0" theme ;; *Bluetooth*) exec "$0" bluetooth ;;
*Clipboard*) exec "$0" clipboard ;;
*Calc*) exec "$0" calc ;;
*Files*) exec "$0" files ;;
*Emoji*) exec "$0" emoji ;;
*Web*) exec "$0" web ;;
*Network*) exec "$0" network ;;
*Bluetooth*) exec "$0" bluetooth ;;
*Capture*) exec "$0" capture ;;
*Keybindings*) exec "$0" keybinds ;;
*Ask*) exec "$0" ask ;;
*"Do Not Disturb"*) exec "$0" dnd ;; *"Do Not Disturb"*) exec "$0" dnd ;;
*Snapshots*) exec "$0" snapshot ;; *Snapshots*) exec "$0" snapshot ;;
*"Power profile"*) exec "$0" power-profile ;; *"Power profile"*) exec "$0" power-profile ;;
*Power*) exec "$0" power ;; *Back*) exec "$0" ;;
esac ;;
"")
# Root picker grouped into category submenus so the top level stays
# short and scannable. Apps/Theme/Power/Keybindings are frequent enough
# to keep at the top; everything else lives under Tools or System.
choice=$(printf '%s\n' \
"󰀻 Apps" \
"󰏘 Theme" \
"󰦬 Tools" \
"󰒓 System" \
"󰐥 Power" \
"󰋖 Keybindings" \
| rofi -dmenu -p menu) || exit 0
case "$choice" in
*Apps*) exec rofi -show drun ;;
*Theme*) exec "$0" theme ;;
*Tools*) exec "$0" tools ;;
*System*) exec "$0" system ;;
*Power*) exec "$0" power ;;
*Keybindings*) exec "$0" keybinds ;;
esac ;; esac ;;
*) *)
echo "usage: nomarchy-menu [power|power-profile|theme|clipboard|calc|files|emoji|web|network|bluetooth|capture|keybinds|ask|dnd|snapshot]" >&2 echo "usage: nomarchy-menu [tools|system|power|power-profile|theme|clipboard|calc|files|emoji|web|network|bluetooth|capture|keybinds|ask|dnd|snapshot]" >&2
exit 64 ;; exit 64 ;;
esac esac
''; '';