Skip to content

keybind-cheatsheet: focus the search box when the panel opens - #535

Open
UmedjonBA wants to merge 1 commit into
noctalia-dev:mainfrom
UmedjonBA:keybind-cheatsheet-search-autofocus
Open

keybind-cheatsheet: focus the search box when the panel opens#535
UmedjonBA wants to merge 1 commit into
noctalia-dev:mainfrom
UmedjonBA:keybind-cheatsheet-search-autofocus

Conversation

@UmedjonBA

Copy link
Copy Markdown
Contributor

Plugin

  • Id: kenn/keybind-cheatsheet
  • New plugin
  • Update to an existing plugin (version bumped in plugin.toml)

What it does

Focuses the search box when the panel opens, so the first keystroke starts filtering instead of being swallowed. Right now the panel has to be clicked in the search field first, which is a small but constant friction for the plugin's main use ("what was that shortcut again?").

One line: the search input gets focus = editingId == nil. The condition keeps the behavior out of the way while a description is being edited in edit mode — that row's own input keeps the caret.

Happy to put it behind a setting (e.g. focus_search_on_open, default on) if you prefer it optional.

External dependencies

None.

Testing

  • Tested on Niri
  • Tested on Hyprland
  • Tested on Sway
  • Tested on another compositor:
  • Noctalia version tested against: v5.0.0-beta.10 (noctalia-git 5.0.0.r5344.g74e6c2790)
  • Plugin API level: 9

Opened the panel and typed immediately (no click): the text lands in the search box and the list filters as expected; the clear button and Escape still behave as before, and edit mode keeps its own input focused.

Note on focus: it is the property the runtime accepts on ui.inputautoFocus, focused and selectAll are rejected with ui tree: 'input' has no prop '…', ignored, so this is the one that works today.

Screenshots / Videos

Panel right after opening, with only keystrokes (no click): the search box holds the caret and the list is already filtered.

Search focused on open

Checklist

Ready-for-review requirement: Every box in this section must be checked. If any statement is not true, keep the
pull request as Draft. An explanation does not replace a required check.

  • The directory name matches the part of id after the / in plugin.toml exactly.
  • It ships plugin.toml, README.md, thumbnail.webp, and translations/en.json.
  • README.md follows the
    README template, documents
    every entry id and dependency, and includes exact panel IPC commands and launcher prefixes where applicable.
  • I created thumbnail.webp with the thumbnail generator.
  • version follows semver and is bumped in this PR; plugin_api is the oldest API level this plugin requires.
  • Every non-English translation in this PR uses a locale supported by Noctalia core, and I can read, write, and
    understand that language well enough to review and maintain it (no unreviewed machine/LLM translations).
  • I did not edit catalog.toml; CI generates it.
  • This PR touches exactly one plugin directory.

Code review attestation

Plugins run as trusted, unsandboxed Luau in the user's session. Confirm:
Ready-for-review requirement: Every attestation below must be checked.

  • The code is readable and not obfuscated, minified, or generated.
  • It does not download and execute remote code.
  • Every network call, filesystem write, and spawned process is something the description above accounts for.
  • I have the right to publish this code under the license declared in plugin.toml.

Both this and #534 branch off main and bump to 0.2.5, since either can land on its own. Whichever you merge first, I will rebase the other and bump its version accordingly — just say the word.

The panel is opened to look a binding up, so the first keystroke should
land in the search box instead of requiring a click there first.

The search input takes focus on render, except while a description is
being edited - that row's own input keeps the caret.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

CC @cheerfulScumbag

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.

1 participant