fix(menu): theme and background submenus return to parent instead of exiting

The menu navigation contract: a submenu invoked directly via keybinding
(BACK_TO_EXIT=true, set by go_to_menu when nomarchy-menu is launched
with a target argument) should `exit 0` after the user's action; a
submenu invoked from a parent menu (BACK_TO_EXIT=false) should call
`back_to <parent>` to return where the user came from. back_to() honors
both modes.

Three submenus violated the contract:

- show_theme_menu and show_background_menu shell out to walker's
  Elephant plugin and don't call back_to. After picking a theme or
  wallpaper from Main -> Style -> Theme, the script exits silently
  instead of returning to Style; the user has to relaunch the menu
  from scratch to change anything else.

- show_hardware_menu's cancel branch called show_trigger_menu directly
  instead of back_to show_trigger_menu, which would have bounced a
  direct-keybinding caller into Trigger instead of exiting cleanly.

Adds the missing back_to call to the two walker-backed submenus
(parented to show_style_menu) and converts the hardware cancel branch
to back_to. The 16 other show_*_menu functions already conform.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-04-30 19:50:36 +01:00
parent f318585dc4
commit a741b0936c
2 changed files with 5 additions and 3 deletions

View File

@@ -161,7 +161,7 @@ show_toggle_menu() {
show_hardware_menu() {
case $(menu "Toggle" " Hybrid GPU") in
*"Hybrid GPU"*) present_terminal nomarchy-toggle-hybrid-gpu ;;
*) show_trigger_menu ;;
*) back_to show_trigger_menu ;;
esac
}
@@ -179,10 +179,12 @@ show_style_menu() {
show_theme_menu() {
nomarchy-launch-walker -m menus:nomarchythemes --width 800 --minheight 400
back_to show_style_menu
}
show_background_menu() {
nomarchy-launch-walker -m menus:nomarchyBackgroundSelector --width 800 --minheight 400
back_to show_style_menu
}
show_font_menu() {