Krolyxon
Commit f7d0d70

Branches

Refs →

budctlREADME.md

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