From 4b99fa38467cd68518f1043ee2d9d87d36864c92 Mon Sep 17 00:00:00 2001 From: Bernardo Magri Date: Thu, 30 Apr 2026 19:53:41 +0100 Subject: [PATCH] fix(menu): route every cancel branch through back_to for direct-keybinding consistency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Audit of all show_*_menu functions after the theme/background fix found 11 more cancel branches that called their parent directly instead of back_to. None are reachable from current keybindings (today's direct invocations target submenus that already use back_to), so the bug is latent — but any future `nomarchy-menu ` keybinding into one of these would bounce the user into the parent on Esc instead of exiting cleanly, the exact bug that prompted the previous commit's fix to show_theme_menu / show_background_menu. Mechanical sweep: *) show_main_menu ;; -> *) back_to show_main_menu ;; (5 sites) *) show_setup_menu ;; -> *) back_to show_setup_menu ;; (3 sites) *) show_update_menu ;; -> *) back_to show_update_menu ;; (3 sites) Behavior under nested navigation (BACK_TO_EXIT=false) is unchanged: back_to falls through to calling the parent function by name. Only direct-invocation cancel paths gain the correct exit-0 behavior. Action branches and go_to_menu's dispatch table intentionally still use direct calls — those are forward navigation, not cancel. Co-Authored-By: Claude Opus 4.7 --- features/scripts/utils/nomarchy-menu | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/features/scripts/utils/nomarchy-menu b/features/scripts/utils/nomarchy-menu index 013753d..bc87152 100755 --- a/features/scripts/utils/nomarchy-menu +++ b/features/scripts/utils/nomarchy-menu @@ -66,7 +66,7 @@ show_learn_menu() { *Arch*) nomarchy-launch-webapp "https://wiki.archlinux.org/title/Main_page" ;; *Bash*) nomarchy-launch-webapp "https://devhints.io/bash" ;; *Neovim*) nomarchy-launch-webapp "https://www.lazyvim.org/keymaps" ;; - *) show_main_menu ;; + *) back_to show_main_menu ;; esac } @@ -76,7 +76,7 @@ show_trigger_menu() { *Share*) show_share_menu ;; *Toggle*) show_toggle_menu ;; *Hardware*) show_hardware_menu ;; - *) show_main_menu ;; + *) back_to show_main_menu ;; esac } @@ -173,7 +173,7 @@ show_style_menu() { *Hyprland*) open_in_editor ~/.config/hypr/looknfeel.conf ;; *Screensaver*) open_in_editor ~/.config/nomarchy/branding/screensaver.txt ;; *About*) open_in_editor ~/.config/nomarchy/branding/about.txt ;; - *) show_main_menu ;; + *) back_to show_main_menu ;; esac } @@ -214,7 +214,7 @@ show_setup_menu() { *DNS*) present_terminal nomarchy-setup-dns ;; *Security*) show_setup_security_menu ;; *Config*) show_setup_config_menu ;; - *) show_main_menu ;; + *) back_to show_main_menu ;; esac } @@ -232,7 +232,7 @@ show_setup_security_menu() { case $(menu "Setup" "󰈷 Fingerprint\n Fido2") in *Fingerprint*) present_terminal nomarchy-setup-fingerprint ;; *Fido2*) present_terminal nomarchy-setup-fido2 ;; - *) show_setup_menu ;; + *) back_to show_setup_menu ;; esac } @@ -248,7 +248,7 @@ show_setup_config_menu() { *Waybar*) open_in_editor ~/.config/waybar/config.jsonc && nomarchy-restart-waybar ;; *XCompose*) open_in_editor ~/.XCompose && nomarchy-restart-xcompose ;; *Overrides*) xdg-open ~/.config/nomarchy/overrides/ ;; - *) show_setup_menu ;; + *) back_to show_setup_menu ;; esac } @@ -271,7 +271,7 @@ show_setup_system_menu() { *Suspend*) nomarchy-toggle-suspend ;; *"Enable Hibernate"*) present_terminal nomarchy-hibernation-setup ;; *"Disable Hibernate"*) present_terminal nomarchy-hibernation-remove ;; - *) show_setup_menu ;; + *) back_to show_setup_menu ;; esac } @@ -287,7 +287,7 @@ show_update_menu() { *Timezone*) present_terminal nomarchy-tz-select ;; *Time*) present_terminal nomarchy-update-time ;; *Password*) show_update_password_menu ;; - *) show_main_menu ;; + *) back_to show_main_menu ;; esac } show_update_process_menu() { @@ -297,7 +297,7 @@ show_update_process_menu() { *Swayosd*) nomarchy-restart-swayosd ;; *Walker*) nomarchy-restart-walker ;; *Waybar*) nomarchy-restart-waybar ;; - *) show_update_menu ;; + *) back_to show_update_menu ;; esac } @@ -308,7 +308,7 @@ show_update_hardware_menu() { *Audio*) present_terminal nomarchy-restart-pipewire ;; *Wi-Fi*) present_terminal nomarchy-restart-wifi ;; *Bluetooth*) present_terminal nomarchy-restart-bluetooth ;; - *) show_update_menu ;; + *) back_to show_update_menu ;; esac } @@ -316,7 +316,7 @@ show_update_password_menu() { case $(menu "Update Password" " Drive Encryption\n User") in *Drive*) present_terminal nomarchy-drive-set-password ;; *User*) present_terminal passwd ;; - *) show_update_menu ;; + *) back_to show_update_menu ;; esac }