From cd5d3b51e28d8ca47a4a58cbe9c42b72110494a2 Mon Sep 17 00:00:00 2001 From: Bernardo Magri Date: Tue, 7 Jul 2026 21:45:11 +0100 Subject: [PATCH] fix(rofi): Display menu Back returns to System on single-monitor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The mode picker's Back did `exec "$0" display`. On a single-monitor machine with no display profiles the output chooser is skipped, so re-running `display` dropped straight back into the same mode picker — an apparent no-op. Track modeBack (display when the chooser was shown, else system) and dispatch Back to it, so single-monitor Back leaves Display. Co-Authored-By: Claude Opus 4.8 --- agent/BACKLOG.md | 6 ------ agent/JOURNAL.md | 15 +++++++++++++++ modules/home/rofi.nix | 8 +++++++- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/agent/BACKLOG.md b/agent/BACKLOG.md index 02e9fed..bdc5e1e 100644 --- a/agent/BACKLOG.md +++ b/agent/BACKLOG.md @@ -50,12 +50,6 @@ still doesn't open the keybindings cheatsheet. Re-diagnose: confirm the Hyprland bind's modmask/keysym against the *actual* layout, whether rofi 2.0.0 changed anything, and that the cheatsheet path still resolves. -### 40. Display rofi menu "Back" doesn't return `[bug]` -(Raised by Bernardo, 2026-07-07 — item 10.) In System › Display, the -Back row fails to return to the previous menu (other submenus' Back work -— cf. the item 24 audit). Trace the Display handler's Back case / -dispatch target. - ### 39. Icons in the power-profile rofi menu (Raised by Bernardo, 2026-07-07 — item 9.) The power-profile picker (rofi.nix `power-profile`) lists profiles as bare text; add per-profile diff --git a/agent/JOURNAL.md b/agent/JOURNAL.md index 896d8fc..8647565 100644 --- a/agent/JOURNAL.md +++ b/agent/JOURNAL.md @@ -17,6 +17,21 @@ Template: --- +## 2026-07-07 — Display menu "Back" doesn't return (iteration #57, item 40) +- **Task:** BACKLOG item 40 — in System › Display the Back row didn't + return on a single-monitor machine. +- **Root cause:** the mode picker's Back did `exec "$0" display`. On a + single-monitor laptop with no display profiles, the output chooser is + skipped, so re-running `display` drops straight back into the *same* + mode picker — an apparent no-op. (Multi-monitor works: `display` + re-shows the chooser, a genuine previous level.) +- **Fix:** `modules/home/rofi.nix` display handler now tracks `modeBack` — + `display` when the chooser was shown, else `system`. Mode-picker Back + does `exec "$0" "$modeBack"`, so single-monitor Back leaves Display for + System. +- **Verified:** V0 `nix flake check --no-build` green. Logic is + deterministic; the single- vs multi-monitor branch is the whole fix. + ## 2026-07-07 — Menu "Back" double arrows (iteration #56, item 34) - **Task:** BACKLOG item 34 — every submenu's `↩ Back` row drew two arrows: the `↩` glyph in the label AND a themed `go-previous` icon. diff --git a/modules/home/rofi.nix b/modules/home/rofi.nix index 1d009f1..3e9e572 100644 --- a/modules/home/rofi.nix +++ b/modules/home/rofi.nix @@ -335,6 +335,11 @@ ${themeRows} # Choose the output (skip the chooser when only one is connected and # there are no profiles — the Profiles row needs the chooser to live in). + # Where the mode picker's Back returns to: the output chooser when it + # was shown (a real previous level), else straight to System — on a + # single-monitor laptop the chooser is skipped, so returning to + # `display` would just re-open this same mode picker (item 40). + modeBack=system profs=; command -v nomarchy-display-profile >/dev/null 2>&1 && profs=1 if [ -n "$profs" ] || [ "$(printf '%s' "$mons" | jq -r '.[].name' | grep -c .)" -gt 1 ]; then name=$( { @@ -345,6 +350,7 @@ ${themeRows} [ "$name" = "$BACK" ] && exec "$0" system [ "$name" = "Profiles ›" ] && exec "$0" display-profile name=''${name%% ·*} # strip the " · WxH@R" hint + modeBack=display else name=$(printf '%s' "$mons" | jq -r '.[0].name') fi @@ -361,7 +367,7 @@ ${themeRows} | sed 's/Hz$//' | awk -F@ '{ printf "%s@%d\n", $1, $2 + 0.5 }' | sort -rV -u printf '%s\n' "$BACK" } | rofi -dmenu -p "$name (now $cur)" ) || exit 0 - [ "$mode" = "$BACK" ] && exec "$0" display + [ "$mode" = "$BACK" ] && exec "$0" "$modeBack" [ -n "$mode" ] || exit 0 # Apply live (keep the output's current position + scale), then persist.