Keys, remote and form factors
Every Taunus screen works by touch and by keys: a TV remote's D-pad, a Bluetooth keyboard. That is handled below the app: if you use theme widgets, your app needs no code for it.
Form factors
tab | tv | |
|---|---|---|
| Input | touch first, keys optional | remote (D-pad, OK, Back, Home) |
| Focus | shown after the first key, hidden again on touch | always shown |
| Look | compact, focus ring | 10-foot: bigger text, inverse highlight and lift, safe area against overscan |
The form factor comes from the device profile (form_factor), Settings › Developer › Form factor, or
TAUNUS_FORM_FACTOR=tab|tv (PC and tests). In Slint read Theme.tv; in Rust taunus_core::form::form_factor().
If your app needs if Theme.tv for navigation, something is missing in the platform: say so instead.
Use Theme.tv only for what differs on purpose: hiding a touch-only option, a copy variant
(Theme.tv ? @tr("x.tv") : @tr("x")).
Pinning
Every theme widget has form-factor: auto | tab | tv. A window can pin itself with
init => { Theme.window-form-factor = FormFactor.tab; }. A pin changes the look, never the keys.
Keys
| Remote | Keyboard | Meaning |
|---|---|---|
| D-pad | arrows | Move the focus. Inside a slider, segmented control or stepper, Left/Right change the value. |
| OK | Enter, Space | Activate (on release) |
| Back | Esc | Back |
| Home | – | Home; twice: Recents (handled by the shell) |
| – | Tab, Shift+Tab | Next/previous, in reading order |
The focus engine
taunus-focus (installed by attach!) moves the focus spatially between focus stops: every theme widget that
can be activated (Button, IconButton, ListRow, Switch, Slider, Segmented, TextField, AppIcon,
Tappable, …). It picks the nearest stop in the pressed direction, scrolls it into view and remembers where you
came from.
Back goes up one level, the first that applies:
- the focused widget (a text field stops editing),
- the topmost
Popup,DialogorMenu(cancel), - a sub-page (
Page { back: true; }→go-back), - a pane (
focus-pane: focus returns to the sidebar), - the window: the shell returns to the app that opened this one, or goes home.
Marking containers
Element ids tell the engine about containers. They are needed rarely:
| Id | Meaning |
|---|---|
focus-default := … | Where the focus starts in this window or trap |
focus-trap := … | A modal area: the focus can't leave it (theme Popup, Dialog, Menu already are) |
focus-pane := … | A group where Back returns the focus to where it came from (the content of a sidebar layout) |
focus-group := … | A sidebar or list: entering it lands on its selected or last used stop |
Your own controls
Never use a bare TouchArea as a target: the remote can't reach it. Wrap it in Tappable:
Tappable {
label: @tr("x.open"); // for screen readers and `tdt layout`
radius: 16px;
clicked => { … }
Image { source: Icon.star; }
}
A custom value control inherits FocusScope, handles Left/Right in key-pressed and returns reject for
everything else, and draws a FocusRing { show: …; }. See the theme's values.slint for examples, and the
Design guidelines.
From Rust
Focus.step(FocusDir.right), Focus.settle() and Focus.enter(dir) are callable from Slint; in Rust the same
in taunus_focus (step, settle, reset, send_key for tests, focused_label).