Skip to content

Preserve menu position and search state when navigating back - #7800

Closed
AnthonyPoschen wants to merge 6 commits into
omacom:quattrofrom
AnthonyPoschen:fix/menu-keyboard-selection
Closed

AnthonyPoschen wants to merge 6 commits into
omacom:quattrofrom
AnthonyPoschen:fix/menu-keyboard-selection

Conversation

@AnthonyPoschen

Copy link
Copy Markdown
Contributor

Why it changed

i liked exploring the menu's with the keyboard and got annoyed the menu selection got reset on me and i couldn't go back a menu without backspacing an entire search. Gif shows the new flow

What changes

Improves keyboard navigation in the Omarchy menu:

  • Returning with Left or Backspace restores the previous menu’s selected row.
  • Each menu level keeps its own search query:
    • entering a submenu starts with an empty search;
    • returning restores the parent menu’s search.
  • Left always navigates back, including while a search query is active.
  • At the top-level menu, Left clears the active search and returns to the normal starting view.
  • Backspace continues to edit an active search; with an empty search it navigates back.

Validation

  • bash test/shell.d/menu-test.sh
  • qmllint shell/plugins/menu/Menu.qml
screenrecording-2026-08-23_04-00-17

Keep the parent row selected when returning from a submenu with the keyboard.

Assisted-by: Codex/GPT-5
Keep the active query while entering and returning from nested menu results.

Assisted-by: Codex/GPT-5
Entering a submenu begins a fresh search while Back restores the query saved for each menu level.

Validation:\n- bash test/shell.d/menu-test.sh\n- qmllint shell/plugins/menu/Menu.qml

Assisted-by: Codex/GPT-5
Keep Backspace available for editing while Left consistently returns to the parent menu.

Validation:\n- bash test/shell.d/menu-test.sh\n- qmllint shell/plugins/menu/Menu.qml

Assisted-by: Codex/GPT-5
Make Left at the top-level menu return to the unfiltered starting view.

Validation:\n- bash test/shell.d/menu-test.sh\n- qmllint shell/plugins/menu/Menu.qml

Assisted-by: Codex/GPT-5
Copilot AI balanced review requested due to automatic review settings August 22, 2026 18:04

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 56389fea66

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread shell/plugins/menu/Menu.qml Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves keyboard navigation in the Omarchy Quickshell menu (shell/plugins/menu/Menu.qml). Previously, navigating back reset the selected row and cleared the search query. Now each menu level remembers its own selected index and search text, so returning with Left/Backspace restores the parent menu's cursor position and filter. navStack is upgraded from a stack of menu-id strings to a stack of { id, selectedIndex, filterText } snapshots to carry this state.

Changes:

  • setActiveMenu gains restoredIndex/restoredFilter params and pushes a full state snapshot onto navStack; goBack restores that snapshot when leaving a submenu.
  • Key handling: Left now always navigates back (and clears an active search at the top level), while Backspace still edits the current search and only navigates back when the search is empty.
  • Updated test/shell.d/menu-test.sh source-pattern assertions to match the new signatures and control flow.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
shell/plugins/menu/Menu.qml Stores per-level selection/search snapshots in navStack, restores them in goBack/setActiveMenu, and reworks the Left/Backspace key handling.
test/shell.d/menu-test.sh Updates source-pattern assertions to cover the new setActiveMenu signature, snapshot push, and back-navigation key flow.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread shell/plugins/menu/Menu.qml Resolved
Limit Left-key menu navigation to regular menu mode so dmenu prompts retain their entered text.

Validation:\n- bash test/shell.d/menu-test.sh\n- qmllint shell/plugins/menu/Menu.qml

Assisted-by: Codex/GPT-5
@AnthonyPoschen

Copy link
Copy Markdown
Contributor Author

i noticed this has progressed, i am available to iterate if needed.

@bjarneo

bjarneo commented Sep 21, 2026

Copy link
Copy Markdown
Member

Automated duplication check: this pull request looks similar to #7074, which covers the same menu goBack selection restore. I keep that one open and close this one to consolidate review.

If you feel this is the wrong decision, please open the PR again with a note on the difference.

@bjarneo bjarneo closed this Sep 21, 2026
@AnthonyPoschen

Copy link
Copy Markdown
Contributor Author

Reopening after the automated duplication check against #7074.

#7074 and this PR both restore the selected row when goBack() returns from a submenu. That is the overlap.

This PR also:

  • Restores each menu level’s search query. navStack stores { id, selectedIndex, filterText }. Entering a submenu still starts empty; Back/Left restores the parent query.
  • Makes Left always navigate back in regular menu mode, including while a search is active. Backspace still edits the query and only navigates when it is empty.
  • At the top-level menu, Left clears the active search and returns to the unfiltered start.
  • Leaves dmenu input/select alone (!root.dmenuActive).

Why the extra state matters: filter root to st, open Style, then go back. #7074 clears the search and applies the filtered index to the unfiltered list, so you land on a different row with the query gone. This PR restores both the query and the matching row.

Behavior #7074 This PR
Restore selected row on back yes yes
Restore that menu’s search query no yes
Left while a search is typed inert until the query is empty always goes back (dmenu excluded)
Backspace with a search edits the query edits the query
Left on the top-level menu with a search unchanged clears search, unfiltered start

Happy to iterate if the smaller cursor-only change is preferred first.

@AnthonyPoschen

Copy link
Copy Markdown
Contributor Author

GitHub does not let me reopen this PR after a maintainer close, so the same branch is now in #12759 with the functional difference from #7074 in the description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants