Repository navigation
Add vim motion navigation to searchable menus - #14899
Perry-Olsson wants to merge 1 commit into
Conversation
The text searchable emoji, clipboard, and main menus now support navigation with vim motion using the control modifier. Extended the PanelKeyCatcher to support this and refactored the menu's mentioned to use this.
|
| const allowedModifiers = Qt.ShiftModifier | Qt.KeypadModifier | ||
| return event.text | ||
| && event.text.length === 1 | ||
| && event.text.charCodeAt(0) >= 32 | ||
| && event.text.charCodeAt(0) !== 127 | ||
| && (event.modifiers & ~allowedModifiers) === 0 |
There was a problem hiding this comment.
If Qt includes GroupSwitchModifier for AltGr input, isTextKey() rejects printable characters such as @, [ and €. These no longer reach the clipboard and emoji filters. The clock's bracket shortcuts also stop working on affected layouts. Previously, these paths accepted printable text regardless of modifiers.
Allow printable AltGr input while still excluding Alt, Ctrl and Meta shortcuts.
There was a problem hiding this comment.
According to the docs this is only a valid modifier on X11 or windows
There was a problem hiding this comment.
You’re right that GroupSwitchModifier is only available on X11 (and optionally Windows), so my original comment was too broad for Wayland.
The underlying concern is still platform-dependent: on X11, Qt may report AltGr using GroupSwitchModifier; on Wayland, it may instead appear as Ctrl+Alt. If Omarchy targets Wayland exclusively and Qt preserves AltGr’s printable event.text there, this specific GroupSwitchModifier change isn’t needed. The behavior should be verified on the supported compositor before changing the filter.
Tip: You can customize Greptile's behavior for this repo with .greptile/rules.md and .greptile/config.json.
| function isVimMotion(event, key) { | ||
| if (event.key != key) { | ||
| return false | ||
| } | ||
|
|
||
| const modifier = searchable | ||
| ? Qt.CTRL | ||
| : Qt.NoModifier | ||
|
|
||
| return event.modifiers === modifier |
There was a problem hiding this comment.
isVimMotion() now checks event.key instead of lowercase event.text. With Caps Lock on, an unshifted L still has Qt.Key_L and no Shift modifier, but its text is uppercase L. Non-searchable panels now take that key as movement instead of passing it to textKey.
This replaces the Dropbox login shortcut with cursor movement. Uppercase J likewise moves instead of jumping on the globe. Keep lowercase-only movement on non-searchable panels, or preserve these uppercase shortcuts before dispatch.
There was a problem hiding this comment.
Interesting, with no caps lock key configured I didn't test this. However, I'd actually consider this behavior change an improvement.
There was a problem hiding this comment.
That makes sense. Given the intended home-row navigation, treating Caps Lock’s Qt.Key_J/K/L/H the same as the corresponding motion keys is a reasonable improvement, and the loss of those uppercase shortcuts is acceptable in this context. I’ll consider this finding resolved.
|
Vim motions in searchable menus look polished and tested. Overlaps #14919 on |
feat: add vim motion navigation to searchable menus
Summary
The text-searchable emoji, clipboard, and main menus now support vim-style navigation with
Ctrl+h/j/k/l, so you can move the cursor without leaving the home row while typing a filter. To make this possible,PanelKeyCatcherwas extended into a shared key-dispatch component, and the three searchable menus were refactored to use it instead of their own ad-hocKeys.onPressedhandlers.Screen Capture
screenrecording-2026-10-10_10-17-57.mp4
Changes
PanelKeyCatcher(shell/Ui/PanelKeyCatcher.qml)searchableproperty: on searchable panels, plainh/j/k/ltypes into the filter andCtrl+h/j/k/lmoves the cursor; on non-searchable panels the plain letters still move, as before.handleCustomKeyssignal, emitted first so a panel can swallow a key before the built-in dispatch runs.pageUp/pageDownsignals and agoBacksignal for Backspace.returnRequestedanddeleteRequestednow carry theKeyEvent, so panels can tellShift+DeletefromDelete(e.g. clipboard clear-history vs. remove entry).Alt+lettershortcuts no longer leak through as typed text.Searchable menus refactored onto
PanelKeyCatchershell/plugins/clipboard/Clipboard.qml): filter editing, Home/End, PageUp/PageDown, Delete vs. Shift+Delete, and the Return-modifier variants (Alt opens, Shift copies) all moved into the catcher's signals.shell/plugins/emojis/Emojis.qml): grid movement, page jumps, and filter editing now go through the catcher.shell/plugins/menu/Menu.qml): movement, paging, delete, and filter editing now go through the catcher.Testing
Extensive testing, review, and iteration was done with the help of Opus 5.5 to ensure all of the previous behavior of the various panels already using PanelKeyCatcher was maintained through the refactor.
Tests added
tst_vim_motions.qml: plainh/j/k/lmove only when not searchable,Ctrl+lettermoves on searchable panels, plain letters type there, andhandleCustomKeysruns first.tst_delete.qml: Delete andx/Xfire delete requests, the key event rides along with modifiers, andxtypes into the filter on searchable panels.tst_modifiers.qml:Alt+letterno longer emits a text key;Shift+letterstill does.