zfin/docs/guides/customize-the-tui.md
Emil Lerch 74fc219afd
All checks were successful
Generic zig build / build (push) Successful in 5m48s
Generic zig build / publish-macos (push) Successful in 11s
Generic zig build / deploy (push) Successful in 23s
add docs/guides
2026-06-22 14:53:53 -07:00

73 lines
2 KiB
Markdown

# Customize the TUI
**Goal:** rebind the interactive TUI's keys and recolor its interface
to your taste.
The TUI reads two optional config files from `~/.config/zfin/`:
[`keys.srf`](../reference/config/keys-srf.md) for keybindings and
[`theme.srf`](../reference/config/theme-srf.md) for colors. When a file
is absent, built-in defaults apply; when present, it is the **sole**
source for that setting.
## Rebind keys
Generate a fully-commented starting file from the current defaults,
then edit it:
```bash
mkdir -p ~/.config/zfin
zfin interactive --default-keys > ~/.config/zfin/keys.srf
$EDITOR ~/.config/zfin/keys.srf
```
Each line binds one action to one key:
```srf
action::quit,key::q
action::next_tab,key::l
action::next_tab,key::right
```
- Add modifiers with `ctrl+`, `alt+`, `shift+` (e.g. `ctrl+d`).
- Bind several keys to an action by repeating the line.
- Scope a binding to one tab with `scope::<tab>` (e.g.
`scope::options`); the `action::` then names that tab's local
action. A tab-local binding may not reuse a globally-bound key --
zfin refuses to start if you create that conflict.
Full key vocabulary and the default bindings:
[`keys.srf` reference](../reference/config/keys-srf.md).
## Recolor the interface
Same pattern for the theme:
```bash
zfin interactive --default-theme > ~/.config/zfin/theme.srf
$EDITOR ~/.config/zfin/theme.srf
```
Every value is a hex RGB string:
```srf
#!srfv1
bg::#0a0a0a
text::#eeeeee
accent::#9d7cd8
positive::#7fd88f
negative::#e06c75
```
The keys cover backgrounds, tabs, text, status line, the modal input,
gains/losses, warnings, selection, and borders -- see the
[`theme.srf` reference](../reference/config/theme-srf.md) for the full
list.
## See also
- [The interactive TUI](../reference/tui.md) -- tabs, actions, and the `?` help overlay.
- [`keys.srf`](../reference/config/keys-srf.md) / [`theme.srf`](../reference/config/theme-srf.md) references.
---
[Previous: A periodic review](periodic-review.md) | [Next: Offline use and refreshing data](offline-and-refresh.md) | [Documentation home](../README.md)