Krolyxon
Commit 7b28e7d

Branches

Refs →

budctlREADME.md

150 lines · 6.5 KB · Markdown

1# budctl
2
3Control your wireless earbuds from Linux, without the vendor app: noise control, EQ, game mode,
4touch controls, battery and more. There is a command-line tool, `budctl`, and a desktop app,
5`budctl-gui`, both built on the same library.
6
7- No telemetry and no account. budctl talks to your buds over Bluetooth, through BlueZ.
8- The settings live on the buds, so budctl works alongside the phone app.
9
10**Supported buds:** realme Buds T310. More are added as the author gets them.
11
12<p align="center">
13 <img src="docs/screenshots/overview.png" width="560" alt="budctl-gui's Overview page: battery of each bud, noise control, and switches such as game mode and 3D sound">
14</p>
15
16## Install
17
18You need Rust 1.88 or newer, BlueZ, and for the desktop app a Wayland desktop.
19
20```sh
21cargo install --path crates/budctl-cli # budctl
22cargo install --path crates/budctl-gui # budctl-gui
23cp contrib/budctl.desktop ~/.local/share/applications/
24```
25
26Pair the buds and connect them in your Bluetooth settings first.
27
28## Command line
29
30```sh
31budctl list # paired buds, and whether budctl knows them
32budctl status # battery, noise control, EQ, switches
33budctl anc off|on|transparency # noise control
34budctl anc light|medium|deep # noise cancelling, at this strength
35budctl eq # the EQ presets, and the one in use
36budctl eq deep-bass # select a preset
37budctl eq custom-4 50=+3 16000=-2 # change bands of a custom preset (dB)
38budctl eq new Gym # create a custom preset: flat, and put to use
39budctl eq rename custom-4 "Gym mix" # rename a custom preset
40budctl eq delete custom-4 # delete a custom preset
41budctl game on|off # game mode (low latency)
42budctl set bass-boost|spatial|wind|dual on|off
43budctl dual # the phones and computers dual connection keeps
44budctl bass 2 # bass level, -5 to +5
45budctl touch # what each tap and hold does
46budctl touch left triple-tap previous # give a gesture an action (--dry-run first, if you like)
47budctl touch cycle off anc # the modes a hold steps through
48budctl find start --yes # ring the buds (loud: take them out of your ears)
49budctl find stop
50```
51
52- `--json` prints machine-readable output for scripts and status bars (`"schema": 1`).
53- `--debug` hex-dumps every frame sent and received, on stderr.
54- `--device <MAC>` picks the buds when more than one supported pair is connected. Without it,
55 `"device"` in the config file (below) is used, if set.
56
57Exit codes:
58
59| Code | Meaning |
60|---|---|
61| 0 | success |
62| 1 | usage error |
63| 2 | buds not found or not connected |
64| 3 | control channel busy |
65| 4 | the buds rejected the command or did not answer |
66
67## Desktop app
68
69`budctl-gui` has five pages:
70
71- **Overview:** battery, noise control and its strength, the switches, the bass level.
72- **Equalizer:** the presets; create, rename and delete your own, and change their bands.
73- **Gestures:** what each tap and hold does on each bud, and what a hold steps through.
74- **Earbud settings:** dual connection and the devices it keeps, find my earbuds, firmware, audio codec.
75- **App settings:** where the colors come from, the keys, the version.
76
77<table>
78 <tr>
79 <td valign="top"><img src="docs/screenshots/equalizer.png" alt="Equalizer: the built-in presets, a custom preset with its pencil and bin, and its six bands open below"></td>
80 <td valign="top"><img src="docs/screenshots/gestures.png" alt="Gestures: double tap, triple tap and hold for each bud, and the modes a hold steps through"></td>
81 </tr>
82 <tr>
83 <td valign="top"><img src="docs/screenshots/earbuds.png" alt="Earbud settings: the dual connection switch, the devices the buds keep, find my earbuds, firmware and codec"></td>
84 <td valign="top"><img src="docs/screenshots/keys.png" alt="The keys overlay, shown with ?"></td>
85 </tr>
86</table>
87
88The screenshots show `--demo`'s made-up buds.
89
90The app connects when it needs to, and frees the buds' control channel 10 s after your last
91change, so other apps can use it. A change shows "Saving…" until the buds confirm it.
92
93The mouse works everywhere. Vim-like keys work on top of it (press `?` in the window):
94
95| Keys | What they do |
96|---|---|
97| `j` `k`, arrows, Tab | move the cursor |
98| `gg` `G` | first / last item |
99| `h` `l` | previous / next choice, switch off / on; `l` opens a row's page |
100| Enter, Space | toggle, step through the choices, or open |
101| `J` `K`, Ctrl+Tab, `gt` `gT` | next / previous page |
102| `1` … `5` | go to a page |
103| `r` | read the buds again |
104| Esc | hide the cursor |
105| `q` | quit |
106
107The cursor shows only after you press a key, and the first key only shows it.
108
109**Colors:** a built-in dark palette with a red accent, or a [matugen](https://github.com/InioX/matugen)
110palette: `--theme <file>`, else `~/.config/budctl/theme.json`. The file is JSON with these keys, all
111optional: `bg`, `fg`, `primary`, `primaryFg`, `primaryContainer`, `secondary`, `surfaceLow`,
112`surface`, `surfaceHigh`, `surfaceHighest`, `outlineVariant`, `surfaceVariantFg`, `err`. It is read
113again whenever the window gets focus, so a new wallpaper's colors show up there too. When the file
114is missing, the app writes the built-in colors there: a starting point for a matugen template.
115
116**Log:** each launch writes errors and session events (connected, each change and its answer,
117closed) to `~/.local/state/budctl/gui.log`, replacing the last launch's.
118
119Other options: `--demo` shows made-up buds without Bluetooth; `--debug` and `--device` work as in
120the command-line tool.
121
122## Config
123
124`~/.config/budctl/config.json` is created with the defaults the first time it is needed. Every key
125is optional; a file with a mistake is reported and the defaults are used.
126
127```json
128{
129 "device": null,
130 "gui": {
131 "idle_seconds": 10,
132 "start_page": "overview"
133 }
134}
135```
136
137- `device`: the buds to use when `--device` is not given, as `"AA:BB:CC:DD:EE:FF"`.
138- `gui.idle_seconds`: how long the app keeps the control channel open after the last change
139 (1–600).
140- `gui.start_page`: `overview`, `equalizer`, `gestures`, `earbuds` or `settings`.
141
142## How it works
143
144budctl speaks the buds' own control protocol over an RFCOMM socket. What is known about it, and
145how sure, is written down in [`docs/protocol/`](docs/protocol/): the
146[transport](docs/protocol/transport.md) and the [realme Buds T310](docs/protocol/realme_t310.md).
147
148## License
149
150GPL-3.0-or-later. See [LICENSE](LICENSE).