Files
Kvaesitso/app/ui
Jonas Haugesen 0f53f7ecdf
Some checks failed
Trigger F-Droid repository rebuild / trigger (release) Has been cancelled
Open the search when typing on a physical keyboard
Typing on a physical keyboard while the home screen is shown now opens the
search page and inserts the typed character, so the launcher can be used
without touching the screen. It works for any printable key, appends the
characters in order even when the user types faster than the launcher can
recompose, and the search bar can still be tapped to edit the query with
the on-screen keyboard as usual.

While the search is driven by the keyboard, the search bar's text field is
left unfocused on purpose: a focused text field would make the system show
the on-screen keyboard, which is not wanted when there is a physical
keyboard. The handler therefore inserts and deletes characters itself,
including backspace and enter (to launch the best match).

The behaviour is controlled by a new "Search on typing" preference in
Settings -> Search, which is enabled by default.

Implementation notes:
- The key events are intercepted in SharedLauncherActivity.dispatchKeyEvent,
  which is the only place that sees hardware key events while no view has
  focus. The scaffold installs the handler while it is shown.
- Key events are not forwarded to the search bar's text field, so the
  characters are inserted into the search view model directly.
- SearchBar keeps a TextFieldValue instead of a String so that the cursor
  moves to the end of the text when the value is changed from the outside.
  Without this the next typed character ended up in front of the text.
2026-09-10 11:45:14 +02:00
..
2022-12-13 17:37:26 +01:00
2026-08-16 15:52:54 +02:00
2026-01-03 00:34:06 +01:00