Commit a0cdbb2
authored
linux-rust(feat): add stem press track control and headless mode support (#469)
* feat: add stem press track control and headless mode support
- Parse STEM_PRESS packets and emit AACPEvent::StemPress with press type and bud side
- Enable double/triple tap detection on init via StemConfig control command (0x06)
- Double press → next track, triple press → previous track via MPRIS D-Bus
- Add next_track() and previous_track() to MediaController
- Add --no-tray flag for headless operation without a GUI
- Replace unwrap() on ui_tx.send() calls with graceful warn! logging
(vibecoded)
* Update main.rs
* feat: make stem press track control optional with GUI toggle
Add a --no-stem-control CLI flag and a toggle in the Settings tab for
environments that handle AirPods AVRCP commands natively (e.g. via
BlueZ/PipeWire). The feature remains enabled by default.
- Load stem_control from app settings JSON on startup; --no-stem-control
overrides it to false regardless of the saved value
- Share an Arc<AtomicBool> between the async backend and the GUI thread;
AirPodsDevice holds the Arc directly so the event loop reads the live
value on every stem press — toggle takes effect immediately without
reconnecting
- Persist stem_control to settings JSON alongside theme and tray_text_mode
- Add a "Controls" section to the Settings tab with a toggler labelled
"Stem press track control", with a subtitle explaining the AVRCP
conflict scenario
- Fix StemConfig bitmask comment to clarify it uses a separate numbering
scheme from the StemPressType event enum values (0x05–0x08)1 parent decf070 commit a0cdbb2
5 files changed
Lines changed: 373 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
203 | 215 | | |
204 | 216 | | |
205 | 217 | | |
206 | 218 | | |
207 | 219 | | |
208 | 220 | | |
209 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
210 | 232 | | |
211 | 233 | | |
212 | 234 | | |
| |||
283 | 305 | | |
284 | 306 | | |
285 | 307 | | |
| 308 | + | |
286 | 309 | | |
287 | 310 | | |
288 | 311 | | |
| |||
795 | 818 | | |
796 | 819 | | |
797 | 820 | | |
798 | | - | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
799 | 841 | | |
800 | 842 | | |
801 | 843 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
83 | 99 | | |
84 | 100 | | |
85 | 101 | | |
| |||
206 | 222 | | |
207 | 223 | | |
208 | 224 | | |
| 225 | + | |
209 | 226 | | |
210 | 227 | | |
211 | 228 | | |
| |||
325 | 342 | | |
326 | 343 | | |
327 | 344 | | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
328 | 370 | | |
329 | 371 | | |
330 | 372 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
| |||
59 | 65 | | |
60 | 66 | | |
61 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
62 | 71 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | 72 | | |
67 | 73 | | |
68 | 74 | | |
| |||
80 | 86 | | |
81 | 87 | | |
82 | 88 | | |
83 | | - | |
84 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
85 | 104 | | |
86 | | - | |
87 | | - | |
88 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
89 | 116 | | |
90 | | - | |
| 117 | + | |
| 118 | + | |
91 | 119 | | |
92 | 120 | | |
93 | 121 | | |
94 | 122 | | |
95 | 123 | | |
| 124 | + | |
96 | 125 | | |
97 | 126 | | |
98 | 127 | | |
| |||
160 | 189 | | |
161 | 190 | | |
162 | 191 | | |
163 | | - | |
| 192 | + | |
164 | 193 | | |
165 | 194 | | |
166 | 195 | | |
| |||
170 | 199 | | |
171 | 200 | | |
172 | 201 | | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
178 | 207 | | |
179 | 208 | | |
180 | 209 | | |
| |||
205 | 234 | | |
206 | 235 | | |
207 | 236 | | |
208 | | - | |
209 | | - | |
210 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
211 | 240 | | |
212 | 241 | | |
213 | 242 | | |
| |||
280 | 309 | | |
281 | 310 | | |
282 | 311 | | |
283 | | - | |
284 | | - | |
285 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
286 | 315 | | |
287 | 316 | | |
288 | 317 | | |
| |||
298 | 327 | | |
299 | 328 | | |
300 | 329 | | |
| 330 | + | |
301 | 331 | | |
302 | | - | |
| 332 | + | |
303 | 333 | | |
304 | 334 | | |
305 | 335 | | |
| |||
308 | 338 | | |
309 | 339 | | |
310 | 340 | | |
311 | | - | |
312 | | - | |
313 | | - | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
314 | 344 | | |
315 | 345 | | |
316 | 346 | | |
| |||
0 commit comments