Krolyxon
Commit 1b48cfa

Branches

Refs →

budctlREADME.md

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