fix(rofi): Display menu Back returns to System on single-monitor
All checks were successful
Check / eval (push) Successful in 3m0s

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 <noreply@anthropic.com>
This commit is contained in:
2026-07-07 21:45:11 +01:00
parent 6c61b51d55
commit cd5d3b51e2
3 changed files with 22 additions and 7 deletions

View File

@@ -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.