Skip to content

Linux + iPhone Continuity / iMessage / SMS

feat: airpods mpris support

Zack Bartel5b0e7de7c0b8
diff --git a/docs/BLUETOOTH.md b/docs/BLUETOOTH.md
index 0402e65..dfb2c9b 100644
--- a/docs/BLUETOOTH.md
+++ b/docs/BLUETOOTH.md
@@ -10,7 +10,7 @@ Bluetooth accessory. No iOS-side code is involved.
| Contacts, for sender names | **PBAP** (Phonebook Access Profile) via `obexd` | BR/EDR | OBEX client |
| Notifications from any app | **ANCS** (Apple Notification Center Service) | BLE / GATT | GATT central |
| Phone calls, place + answer | **HFP** (Hands-Free Profile) via BlueZ | BR/EDR | Hands-free unit |
-| AirPods battery + listening mode | **AAP** (Apple Accessory Protocol) | BR/EDR / L2CAP | L2CAP client |
+| AirPods battery, listening mode, in-ear | **AAP** (Apple Accessory Protocol) | BR/EDR / L2CAP | L2CAP client |
The Tether iOS app is unrelated to these features and just keeps handling clipboard sync and file transfer over TCP + mTLS.
@@ -479,8 +479,8 @@ the narrower check; it rules out the `*`/`#` supplementary-service codes deliber
## AirPods
-Battery for the buds and the case, and the listening mode, in the Devices list and from
-`tether --bt-airpods`. No ear detection or stem control yet.
+Battery for the buds and the case, the listening mode, and in-ear detection, in the
+Devices list and from `tether --bt-airpods`. No stem control yet.
It is the one feature here that does not go through BlueZ. AirPods report battery over
Apple's Accessory Protocol on an L2CAP channel, PSM `0x1001`, the same source an iPhone
@@ -537,6 +537,40 @@ Writes are queued for the reader thread rather than sent from the caller's, beca
socket belongs to the session and closing it out from under a write is the one race worth
not having. A queued change does not outlive the channel it was meant for.
+### In-ear detection, and pausing
+
+Eight bytes, `04 00 04 00 06 00 [primary] [secondary]`, with `00` in the ear, `01` out of
+it, `02` in the case and anything else unknown.
+
+They are a **primary and a secondary, not a left and a right**, and which bud is which
+moves between them. So nothing here names a side; the count of buds in ears is what the
+policy and the UI use.
+
+Taking a bud out can pause whatever is playing locally, over MPRIS. It is **off by
+default** -- `airpods_pause` in `bluetooth.json`, `never`, `one-removed` or `both-removed`
+-- for the same reason call control is: nothing reaches out and touches the user's session
+until they ask for it. `tether --bt-airpods-pause one-removed`, or the dropdown on the
+AirPods page.
+
+The policy is `ear_media_action()`, kept pure so its awkward cases are settled by tests
+rather than by taking earbuds out repeatedly:
+
+- **The first ear report after connecting is not a transition.** The buds say where they
+ already are as soon as the channel opens, and reading that as a change would pause the
+ music the moment a case is opened near the machine.
+- **Only a pause Tether made is undone.** Playback the user stopped by hand stays stopped.
+- A bud in the case counts the same as a bud out of the ear.
+- **Buds that disconnect entirely leave the pause in place.** Resuming there would move
+ the audio to the machine's own speakers, which is not what taking an earbud out asked
+ for.
+
+MPRIS itself is `src/core/src/mpris.cpp`, a plain session-bus client: `ListNames`, keep
+the `org.mpris.MediaPlayer2.` ones, pause the players reporting `Playing`, remember them,
+play those back. Calls carry `G_DBUS_CALL_FLAGS_NO_AUTO_START` and a one-second timeout,
+because a bus name can be *activatable* rather than running -- `playerctld` usually is --
+and neither starting a media player to interrogate it nor blocking the Bluetooth reader
+thread on one is acceptable.
+
The constants come from librepods `linux/airpods_packets.h`. The prose
`docs/AAP Definitions.md` in the same repository disagrees with the header and is wrong.
@@ -622,6 +656,8 @@ checks the daemon does not make.
| `tether --bt-calls` reports call control off | PipeWire took the profile *and* its telephony D-Bus service is off, the iPhone reconnected on its own and never opened hands-free, or `bluetoothd` is running without `--experimental` | Either give BlueZ the profile by dropping `hfp_hf` from `bluez5.roles`, or set `bluez5.telephony-dbus-service = true` and let Tether drive PipeWire's gateway -- see "Calls". The daemon cycles the BR/EDR bearer once per outage for the second cause; confirm with `busctl --system tree org.bluez \| grep telephony` and `busctl --user tree org.pipewire.Telephony` |
| AirPods are listed but the battery stays blank, and the row says another program is using the channel | The AAP channel takes one client, and something else has it | Stop the other AirPods program (LibrePods, AirPods Center, a status-bar widget that reads battery). Nothing else releases it |
| Setting the AirPods listening mode to `off` does nothing, while the other three work | The buds declined it. Apple leaves Off out of the noise-control rotation by default on Pro models, and there is no refusal to report | Add Off to the rotation on the phone, under Settings > Bluetooth > (i) > Noise Control. Tether keeps showing the mode the buds are actually in |
+| Playback does not pause when a bud comes out | Pause on removal is off, which is the default | Set it on the AirPods page, or `tether --bt-airpods-pause one-removed` |
+| Playback pauses on removal but never resumes | Something else paused or stopped it in between, so the pause is no longer Tether's to undo. Or the buds disconnected, which deliberately leaves it paused | Press play. Both are working as designed |
| AirPods do not appear in the Devices list at all | They are not connected, or BlueZ has never read their SDP record so there is no Modalias and the name does not contain "airpod" | Connect them, then `tether --bt-devices` -- the row carries an `airpods` flag when Tether recognizes them |
| Calls work but the audio is on the iPhone | Working as designed. BlueZ signals the call and never opens the voice link, so there is nothing to route here | Nothing. `./scripts/bt-probe.sh --calls` during a call shows the evidence; "Getting the call audio onto the desktop instead" is the trade if you want it |
| The Calls page is empty after configuring PipeWire for call audio | PipeWire's telephony D-Bus service is off, so neither stack exports anything Tether can read | Set `bluez5.telephony-dbus-service = true` and reconnect. With it on, Tether drives PipeWire's gateway directly and the Calls page works, minus carrier and signal |
diff --git a/docs/PROTOCOL.md b/docs/PROTOCOL.md
index 7e62897..04840b0 100644
--- a/docs/PROTOCOL.md
+++ b/docs/PROTOCOL.md
@@ -351,6 +351,8 @@ entries only gain an `airpods` boolean saying which device the battery belongs t
"right": 79,
"case": 45,
"anc": "transparency",
+ "ear": {"primary": "in_ear", "secondary": "out_of_ear"},
+ "in_ear": 1,
"status": "live",
"reason": ""
}
@@ -368,6 +370,16 @@ sentence to show.
that does not report one. It always reflects what the buds say they are doing, never what
was last requested.
+`ear` is where each bud is: `in_ear`, `out_of_ear`, `in_case` or `unknown`. They are a
+primary and a secondary rather than a left and a right, and which is which moves between
+them, so `in_ear` carries the count and nothing names a side.
+
+#### `bt_airpods_pause` (Client -> Daemon)
+**Payload**: `{"command": "bt_airpods_pause", "mode": "one-removed"}`
+
+Whether removing a bud pauses local playback: `never` (the default), `one-removed` or
+`both-removed`. Persisted, and reported back as `airpods_pause` in `bt_status`.
+
#### `bt_airpods_mode` (Client -> Daemon, answered directly)
**Payload**: `{"command": "bt_airpods_mode", "mode": "transparency"}`
**Response**: `{"command": "bt_airpods_mode_result", "success": true}`, or `success` false
diff --git a/docs/man/man1/tether.1.in b/docs/man/man1/tether.1.in
index 41432d8..2431991 100644
--- a/docs/man/man1/tether.1.in
+++ b/docs/man/man1/tether.1.in
@@ -94,6 +94,10 @@ Show AirPods battery, for each bud and the case, and the current listening mode.
Set the AirPods listening mode. The buds decline a mode they are not configured for
without reporting an error, so check the result with \fB\-\-bt-airpods\fR.
.TP
+\fB\-\-bt-airpods-pause\fR \fInever\fR|\fIone-removed\fR|\fIboth-removed\fR
+Pause whatever is playing on this computer when an AirPod is removed, and start it again
+when the buds go back in. Off by default. Only playback Tether paused is resumed.
+.TP
\fB\-\-bt-pair\fR \fIADDRESS\fR
Pair with an iPhone over Bluetooth.
.TP
diff --git a/po/cs.po b/po/cs.po
index 6e90429..74f3a39 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-08 16:30-0700\n"
+"POT-Creation-Date: 2026-09-08 16:56-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Czech\n"
@@ -95,6 +95,10 @@ msgstr "Zobrazit baterii AirPods a pouzdra."
msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
msgstr "Nastavit režim poslechu AirPods: off, anc, transparency, adaptive."
+#: src/cli/main.cpp
+msgid "Pause local playback when an AirPod is removed: never, one-removed, both-removed."
+msgstr "Pozastavit místní přehrávání při vyjmutí AirPodu: never, one-removed, both-removed."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Vypsat konverzace zpráv z iPhonu."
@@ -462,6 +466,10 @@ msgstr "Pravé"
msgid "Case"
msgstr "Pouzdro"
+#: src/cli/main.cpp
+msgid "Worn"
+msgstr "Nošení"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Nepodařilo se spojit s démonem.\n"
@@ -475,6 +483,14 @@ msgstr "Režim poslechu nastaven na %s.\n"
msgid "The listening mode could not be set."
msgstr "Režim poslechu se nepodařilo nastavit."
+#: src/cli/main.cpp
+msgid "Use never, one-removed or both-removed.\n"
+msgstr "Použijte never, one-removed nebo both-removed.\n"
+
+#: src/cli/main.cpp
+msgid "Pause on removal set to %s.\n"
+msgstr "Pozastavení při vyjmutí nastaveno na %s.\n"
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Démon uzavřel spojení dříve, než operace skončila.\n"
@@ -1489,6 +1505,22 @@ msgstr "Potlačení hluku"
msgid "These AirPods do not report a listening mode."
msgstr "Tato AirPods nehlásí režim poslechu."
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report whether they are being worn."
+msgstr "Tato AirPods nehlásí, zda jsou nasazena."
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are in."
+msgstr "Obě sluchátka jsou v uších."
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is in."
+msgstr "Jedno sluchátko je v uchu."
+
+#: src/gtk/devices_view.cpp
+msgid "Neither bud is in."
+msgstr "Žádné sluchátko není v uchu."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Plný režim — zprávy, kontakty a oznámení."
@@ -1783,6 +1815,30 @@ msgstr "Hledat zařízení"
msgid "Listening mode"
msgstr "Režim poslechu"
+#: src/gtk/devices_view.cpp
+msgid "In-ear detection"
+msgstr "Detekce v uchu"
+
+#: src/gtk/devices_view.cpp
+msgid "Pause playback when:"
+msgstr "Pozastavit přehrávání, když:"
+
+#: src/gtk/devices_view.cpp
+msgid "Never"
+msgstr "Nikdy"
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is removed"
+msgstr "Je vyjmuto jedno sluchátko"
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are removed"
+msgstr "Jsou vyjmuta obě sluchátka"
+
+#: src/gtk/devices_view.cpp
+msgid "Pauses whatever is playing on this computer, and starts it again when the buds go back in. Only playback Tether paused is resumed."
+msgstr "Pozastaví vše, co se na tomto počítači přehrává, a znovu to spustí, jakmile si sluchátka nasadíte. Obnoví se pouze přehrávání, které pozastavil Tether."
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth vyžaduje jednorázové nastavení systému"
diff --git a/po/de.po b/po/de.po
index 590c81f..3cf92f8 100644
--- a/po/de.po
+++ b/po/de.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-08 16:30-0700\n"
+"POT-Creation-Date: 2026-09-08 16:56-0700\n"
"PO-Revision-Date: 2026-08-22\n"
"Last-Translator: Tether project\n"
"Language-Team: German\n"
@@ -95,6 +95,10 @@ msgstr "Akkustand der AirPods und des Ladecase anzeigen."
msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
msgstr "AirPods-Hörmodus setzen: off, anc, transparency, adaptive."
+#: src/cli/main.cpp
+msgid "Pause local playback when an AirPod is removed: never, one-removed, both-removed."
+msgstr "Lokale Wiedergabe pausieren, wenn ein AirPod herausgenommen wird: never, one-removed, both-removed."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Nachrichtenunterhaltungen des iPhones auflisten."
@@ -460,6 +464,10 @@ msgstr "Rechts"
msgid "Case"
msgstr "Case"
+#: src/cli/main.cpp
+msgid "Worn"
+msgstr "Getragen"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Der Daemon war nicht erreichbar.\n"
@@ -473,6 +481,14 @@ msgstr "Hörmodus auf %s gesetzt.\n"
msgid "The listening mode could not be set."
msgstr "Der Hörmodus konnte nicht gesetzt werden."
+#: src/cli/main.cpp
+msgid "Use never, one-removed or both-removed.\n"
+msgstr "Verwenden Sie never, one-removed oder both-removed.\n"
+
+#: src/cli/main.cpp
+msgid "Pause on removal set to %s.\n"
+msgstr "Pause beim Herausnehmen auf %s gesetzt.\n"
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr ""
@@ -1519,6 +1535,22 @@ msgstr "Geräuschunterdrückung"
msgid "These AirPods do not report a listening mode."
msgstr "Diese AirPods melden keinen Hörmodus."
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report whether they are being worn."
+msgstr "Diese AirPods melden nicht, ob sie getragen werden."
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are in."
+msgstr "Beide Hörer sind eingesetzt."
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is in."
+msgstr "Ein Hörer ist eingesetzt."
+
+#: src/gtk/devices_view.cpp
+msgid "Neither bud is in."
+msgstr "Kein Hörer ist eingesetzt."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Vollmodus — Nachrichten, Kontakte und Mitteilungen."
@@ -1818,6 +1850,30 @@ msgstr "Nach Geräten suchen"
msgid "Listening mode"
msgstr "Hörmodus"
+#: src/gtk/devices_view.cpp
+msgid "In-ear detection"
+msgstr "Trageerkennung"
+
+#: src/gtk/devices_view.cpp
+msgid "Pause playback when:"
+msgstr "Wiedergabe pausieren, wenn:"
+
+#: src/gtk/devices_view.cpp
+msgid "Never"
+msgstr "Nie"
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is removed"
+msgstr "Ein Hörer herausgenommen wird"
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are removed"
+msgstr "Beide Hörer herausgenommen werden"
+
+#: src/gtk/devices_view.cpp
+msgid "Pauses whatever is playing on this computer, and starts it again when the buds go back in. Only playback Tether paused is resumed."
+msgstr "Pausiert alles, was auf diesem Computer läuft, und setzt es fort, sobald die Hörer wieder eingesetzt sind. Nur von Tether pausierte Wiedergabe wird fortgesetzt."
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth braucht eine einmalige Systemeinrichtung"
diff --git a/po/es.po b/po/es.po
index 9a65d0b..e8e7891 100644
--- a/po/es.po
+++ b/po/es.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-08 16:30-0700\n"
+"POT-Creation-Date: 2026-09-08 16:56-0700\n"
"PO-Revision-Date: 2026-08-22\n"
"Last-Translator: Tether project\n"
"Language-Team: Spanish\n"
@@ -98,6 +98,10 @@ msgstr ""
"Establecer el modo de escucha de los AirPods: off, anc, transparency, "
"adaptive."
+#: src/cli/main.cpp
+msgid "Pause local playback when an AirPod is removed: never, one-removed, both-removed."
+msgstr "Pausar la reproducción local al quitar un AirPod: never, one-removed, both-removed."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Listar las conversaciones de mensajes del iPhone."
@@ -464,6 +468,10 @@ msgstr "Der."
msgid "Case"
msgstr "Estuche"
+#: src/cli/main.cpp
+msgid "Worn"
+msgstr "Puestos"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "No se pudo contactar con el daemon.\n"
@@ -477,6 +485,14 @@ msgstr "Modo de escucha establecido en %s.\n"
msgid "The listening mode could not be set."
msgstr "No se pudo establecer el modo de escucha."
+#: src/cli/main.cpp
+msgid "Use never, one-removed or both-removed.\n"
+msgstr "Use never, one-removed o both-removed.\n"
+
+#: src/cli/main.cpp
+msgid "Pause on removal set to %s.\n"
+msgstr "Pausa al quitarlos establecida en %s.\n"
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "El daemon cerró la conexión antes de terminar la operación.\n"
@@ -1512,6 +1528,22 @@ msgstr "Cancelación de ruido"
msgid "These AirPods do not report a listening mode."
msgstr "Estos AirPods no informan de un modo de escucha."
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report whether they are being worn."
+msgstr "Estos AirPods no informan de si se están llevando puestos."
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are in."
+msgstr "Ambos auriculares están puestos."
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is in."
+msgstr "Un auricular está puesto."
+
+#: src/gtk/devices_view.cpp
+msgid "Neither bud is in."
+msgstr "Ningún auricular está puesto."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Modo completo — mensajes, contactos y notificaciones."
@@ -1810,6 +1842,30 @@ msgstr "Buscar dispositivos"
msgid "Listening mode"
msgstr "Modo de escucha"
+#: src/gtk/devices_view.cpp
+msgid "In-ear detection"
+msgstr "Detección en el oído"
+
+#: src/gtk/devices_view.cpp
+msgid "Pause playback when:"
+msgstr "Pausar la reproducción cuando:"
+
+#: src/gtk/devices_view.cpp
+msgid "Never"
+msgstr "Nunca"
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is removed"
+msgstr "Se quite un auricular"
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are removed"
+msgstr "Se quiten ambos auriculares"
+
+#: src/gtk/devices_view.cpp
+msgid "Pauses whatever is playing on this computer, and starts it again when the buds go back in. Only playback Tether paused is resumed."
+msgstr "Pausa lo que se esté reproduciendo en este equipo y lo reanuda cuando vuelvas a ponerte los auriculares. Solo se reanuda la reproducción que pausó Tether."
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth necesita una configuración inicial del sistema"
diff --git a/po/fr.po b/po/fr.po
index ab00b1f..7c2bf50 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-08 16:30-0700\n"
+"POT-Creation-Date: 2026-09-08 16:56-0700\n"
"PO-Revision-Date: 2026-08-22\n"
"Last-Translator: Tether project\n"
"Language-Team: French\n"
@@ -98,6 +98,10 @@ msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
msgstr ""
"Définir le mode d'écoute des AirPods : off, anc, transparency, adaptive."
+#: src/cli/main.cpp
+msgid "Pause local playback when an AirPod is removed: never, one-removed, both-removed."
+msgstr "Mettre en pause la lecture locale au retrait d'un AirPods : never, one-removed, both-removed."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Lister les conversations de l'iPhone."
@@ -467,6 +471,10 @@ msgstr "Droite"
msgid "Case"
msgstr "Boîtier"
+#: src/cli/main.cpp
+msgid "Worn"
+msgstr "Portés"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Impossible de joindre le démon.\n"
@@ -480,6 +488,14 @@ msgstr "Mode d'écoute réglé sur %s.\n"
msgid "The listening mode could not be set."
msgstr "Impossible de régler le mode d'écoute."
+#: src/cli/main.cpp
+msgid "Use never, one-removed or both-removed.\n"
+msgstr "Utilisez never, one-removed ou both-removed.\n"
+
+#: src/cli/main.cpp
+msgid "Pause on removal set to %s.\n"
+msgstr "Pause au retrait réglée sur %s.\n"
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Le démon a fermé la connexion avant la fin de l'opération.\n"
@@ -1519,6 +1535,22 @@ msgstr "Réduction de bruit"
msgid "These AirPods do not report a listening mode."
msgstr "Ces AirPods ne signalent pas de mode d'écoute."
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report whether they are being worn."
+msgstr "Ces AirPods ne signalent pas s'ils sont portés."
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are in."
+msgstr "Les deux écouteurs sont en place."
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is in."
+msgstr "Un écouteur est en place."
+
+#: src/gtk/devices_view.cpp
+msgid "Neither bud is in."
+msgstr "Aucun écouteur n'est en place."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Mode complet — messages, contacts et notifications."
@@ -1817,6 +1849,30 @@ msgstr "Rechercher des appareils"
msgid "Listening mode"
msgstr "Mode d'écoute"
+#: src/gtk/devices_view.cpp
+msgid "In-ear detection"
+msgstr "Détection de port"
+
+#: src/gtk/devices_view.cpp
+msgid "Pause playback when:"
+msgstr "Mettre en pause la lecture quand :"
+
+#: src/gtk/devices_view.cpp
+msgid "Never"
+msgstr "Jamais"
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is removed"
+msgstr "Un écouteur est retiré"
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are removed"
+msgstr "Les deux écouteurs sont retirés"
+
+#: src/gtk/devices_view.cpp
+msgid "Pauses whatever is playing on this computer, and starts it again when the buds go back in. Only playback Tether paused is resumed."
+msgstr "Met en pause ce qui est lu sur cet ordinateur et le relance quand les écouteurs sont remis en place. Seule la lecture mise en pause par Tether est relancée."
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth requiert une configuration système ponctuelle"
diff --git a/po/it.po b/po/it.po
index 90cccb0..94c6f8e 100644
--- a/po/it.po
+++ b/po/it.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-08 16:30-0700\n"
+"POT-Creation-Date: 2026-09-08 16:56-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Italian\n"
@@ -99,6 +99,10 @@ msgstr ""
"Imposta la modalità di ascolto degli AirPods: off, anc, transparency, "
"adaptive."
+#: src/cli/main.cpp
+msgid "Pause local playback when an AirPod is removed: never, one-removed, both-removed."
+msgstr "Metti in pausa la riproduzione locale quando un AirPod viene rimosso: never, one-removed, both-removed."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Elenca le conversazioni di messaggi dell'iPhone."
@@ -464,6 +468,10 @@ msgstr "Destro"
msgid "Case"
msgstr "Custodia"
+#: src/cli/main.cpp
+msgid "Worn"
+msgstr "Indossati"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Impossibile raggiungere il daemon.\n"
@@ -477,6 +485,14 @@ msgstr "Modalità di ascolto impostata su %s.\n"
msgid "The listening mode could not be set."
msgstr "Impossibile impostare la modalità di ascolto."
+#: src/cli/main.cpp
+msgid "Use never, one-removed or both-removed.\n"
+msgstr "Usa never, one-removed o both-removed.\n"
+
+#: src/cli/main.cpp
+msgid "Pause on removal set to %s.\n"
+msgstr "Pausa alla rimozione impostata su %s.\n"
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Il daemon ha chiuso la connessione prima che l'operazione finisse.\n"
@@ -1511,6 +1527,22 @@ msgstr "Cancellazione del rumore"
msgid "These AirPods do not report a listening mode."
msgstr "Questi AirPods non segnalano una modalità di ascolto."
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report whether they are being worn."
+msgstr "Questi AirPods non segnalano se sono indossati."
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are in."
+msgstr "Entrambi gli auricolari sono indossati."
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is in."
+msgstr "Un auricolare è indossato."
+
+#: src/gtk/devices_view.cpp
+msgid "Neither bud is in."
+msgstr "Nessun auricolare è indossato."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Modalità completa — messaggi, contatti e notifiche."
@@ -1810,6 +1842,30 @@ msgstr "Cerca dispositivi"
msgid "Listening mode"
msgstr "Modalità di ascolto"
+#: src/gtk/devices_view.cpp
+msgid "In-ear detection"
+msgstr "Rilevamento nell'orecchio"
+
+#: src/gtk/devices_view.cpp
+msgid "Pause playback when:"
+msgstr "Metti in pausa la riproduzione quando:"
+
+#: src/gtk/devices_view.cpp
+msgid "Never"
+msgstr "Mai"
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is removed"
+msgstr "Un auricolare viene rimosso"
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are removed"
+msgstr "Entrambi gli auricolari vengono rimossi"
+
+#: src/gtk/devices_view.cpp
+msgid "Pauses whatever is playing on this computer, and starts it again when the buds go back in. Only playback Tether paused is resumed."
+msgstr "Mette in pausa ciò che è in riproduzione su questo computer e lo riavvia quando gli auricolari vengono rimessi. Viene ripresa solo la riproduzione messa in pausa da Tether."
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth richiede una configurazione di sistema una tantum"
diff --git a/po/ja.po b/po/ja.po
index 328840e..4ba4749 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-08 16:30-0700\n"
+"POT-Creation-Date: 2026-09-08 16:56-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Japanese\n"
@@ -96,6 +96,10 @@ msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
msgstr ""
"AirPods のリスニングモードを設定します: off, anc, transparency, adaptive。"
+#: src/cli/main.cpp
+msgid "Pause local playback when an AirPod is removed: never, one-removed, both-removed."
+msgstr "AirPod を外したときにローカル再生を一時停止します: never, one-removed, both-removed。"
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "iPhone のメッセージの会話を一覧表示します。"
@@ -453,6 +457,10 @@ msgstr "右"
msgid "Case"
msgstr "ケース"
+#: src/cli/main.cpp
+msgid "Worn"
+msgstr "装着"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "デーモンに接続できませんでした。\n"
@@ -466,6 +474,14 @@ msgstr "リスニングモードを %s に設定しました。\n"
msgid "The listening mode could not be set."
msgstr "リスニングモードを設定できませんでした。"
+#: src/cli/main.cpp
+msgid "Use never, one-removed or both-removed.\n"
+msgstr "never、one-removed、both-removed のいずれかを指定してください。\n"
+
+#: src/cli/main.cpp
+msgid "Pause on removal set to %s.\n"
+msgstr "取り外し時の一時停止を %s に設定しました。\n"
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "操作が完了する前にデーモンが接続を閉じました。\n"
@@ -1482,6 +1498,22 @@ msgstr "ノイズキャンセリング"
msgid "These AirPods do not report a listening mode."
msgstr "この AirPods はリスニングモードを報告しません。"
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report whether they are being worn."
+msgstr "この AirPods は装着状態を報告しません。"
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are in."
+msgstr "両方のイヤホンを装着しています。"
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is in."
+msgstr "片方のイヤホンを装着しています。"
+
+#: src/gtk/devices_view.cpp
+msgid "Neither bud is in."
+msgstr "イヤホンを装着していません。"
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "フルモード — メッセージ、連絡先、通知。"
@@ -1776,6 +1808,30 @@ msgstr "デバイスを検索"
msgid "Listening mode"
msgstr "リスニングモード"
+#: src/gtk/devices_view.cpp
+msgid "In-ear detection"
+msgstr "装着検出"
+
+#: src/gtk/devices_view.cpp
+msgid "Pause playback when:"
+msgstr "再生を一時停止する条件:"
+
+#: src/gtk/devices_view.cpp
+msgid "Never"
+msgstr "しない"
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is removed"
+msgstr "片方を外したとき"
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are removed"
+msgstr "両方を外したとき"
+
+#: src/gtk/devices_view.cpp
+msgid "Pauses whatever is playing on this computer, and starts it again when the buds go back in. Only playback Tether paused is resumed."
+msgstr "このコンピュータで再生中のものを一時停止し、イヤホンを装着し直すと再開します。Tether が一時停止した再生のみを再開します。"
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth には一度きりのシステム設定が必要です"
diff --git a/po/ko.po b/po/ko.po
index abaff75..37071e1 100644
--- a/po/ko.po
+++ b/po/ko.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-08 16:30-0700\n"
+"POT-Creation-Date: 2026-09-08 16:56-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Korean\n"
@@ -94,6 +94,10 @@ msgstr "AirPods 및 케이스 배터리를 표시합니다."
msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
msgstr "AirPods 청취 모드를 설정합니다: off, anc, transparency, adaptive."
+#: src/cli/main.cpp
+msgid "Pause local playback when an AirPod is removed: never, one-removed, both-removed."
+msgstr "AirPod을 뺐을 때 로컬 재생을 일시정지합니다: never, one-removed, both-removed."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "iPhone의 메시지 대화를 나열합니다."
@@ -450,6 +454,10 @@ msgstr "오른쪽"
msgid "Case"
msgstr "케이스"
+#: src/cli/main.cpp
+msgid "Worn"
+msgstr "착용"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "데몬에 연결하지 못했습니다.\n"
@@ -463,6 +471,14 @@ msgstr "청취 모드를 %s(으)로 설정했습니다.\n"
msgid "The listening mode could not be set."
msgstr "청취 모드를 설정할 수 없습니다."
+#: src/cli/main.cpp
+msgid "Use never, one-removed or both-removed.\n"
+msgstr "never, one-removed 또는 both-removed 중에서 선택하세요.\n"
+
+#: src/cli/main.cpp
+msgid "Pause on removal set to %s.\n"
+msgstr "제거 시 일시정지를 %s(으)로 설정했습니다.\n"
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "작업이 끝나기 전에 데몬이 연결을 닫았습니다.\n"
@@ -1464,6 +1480,22 @@ msgstr "노이즈 캔슬링"
msgid "These AirPods do not report a listening mode."
msgstr "이 AirPods는 청취 모드를 보고하지 않습니다."
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report whether they are being worn."
+msgstr "이 AirPods는 착용 여부를 보고하지 않습니다."
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are in."
+msgstr "양쪽 이어버드를 착용 중입니다."
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is in."
+msgstr "한쪽 이어버드를 착용 중입니다."
+
+#: src/gtk/devices_view.cpp
+msgid "Neither bud is in."
+msgstr "이어버드를 착용하지 않았습니다."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "전체 모드 — 메시지, 연락처, 알림."
@@ -1754,6 +1786,30 @@ msgstr "기기 검색"
msgid "Listening mode"
msgstr "청취 모드"
+#: src/gtk/devices_view.cpp
+msgid "In-ear detection"
+msgstr "착용 감지"
+
+#: src/gtk/devices_view.cpp
+msgid "Pause playback when:"
+msgstr "재생을 일시정지할 때:"
+
+#: src/gtk/devices_view.cpp
+msgid "Never"
+msgstr "안 함"
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is removed"
+msgstr "한쪽을 뺐을 때"
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are removed"
+msgstr "양쪽을 뺐을 때"
+
+#: src/gtk/devices_view.cpp
+msgid "Pauses whatever is playing on this computer, and starts it again when the buds go back in. Only playback Tether paused is resumed."
+msgstr "이 컴퓨터에서 재생 중인 것을 일시정지하고, 이어버드를 다시 착용하면 재생을 재개합니다. Tether가 일시정지한 재생만 재개됩니다."
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth에는 일회성 시스템 설정이 필요합니다"
diff --git a/po/nl.po b/po/nl.po
index 9415a3b..51c4346 100644
--- a/po/nl.po
+++ b/po/nl.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-08 16:30-0700\n"
+"POT-Creation-Date: 2026-09-08 16:56-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Dutch\n"
@@ -96,6 +96,10 @@ msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
msgstr ""
"De luistermodus van de AirPods instellen: off, anc, transparency, adaptive."
+#: src/cli/main.cpp
+msgid "Pause local playback when an AirPod is removed: never, one-removed, both-removed."
+msgstr "Lokale weergave pauzeren wanneer een AirPod wordt uitgenomen: never, one-removed, both-removed."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Berichtgesprekken van de iPhone tonen."
@@ -461,6 +465,10 @@ msgstr "Rechts"
msgid "Case"
msgstr "Case"
+#: src/cli/main.cpp
+msgid "Worn"
+msgstr "Gedragen"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Kon de daemon niet bereiken.\n"
@@ -474,6 +482,14 @@ msgstr "Luistermodus ingesteld op %s.\n"
msgid "The listening mode could not be set."
msgstr "De luistermodus kon niet worden ingesteld."
+#: src/cli/main.cpp
+msgid "Use never, one-removed or both-removed.\n"
+msgstr "Gebruik never, one-removed of both-removed.\n"
+
+#: src/cli/main.cpp
+msgid "Pause on removal set to %s.\n"
+msgstr "Pauzeren bij uitnemen ingesteld op %s.\n"
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "De daemon sloot de verbinding voordat de bewerking klaar was.\n"
@@ -1502,6 +1518,22 @@ msgstr "Ruisonderdrukking"
msgid "These AirPods do not report a listening mode."
msgstr "Deze AirPods melden geen luistermodus."
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report whether they are being worn."
+msgstr "Deze AirPods melden niet of ze gedragen worden."
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are in."
+msgstr "Beide oordopjes zijn in."
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is in."
+msgstr "Eén oordopje is in."
+
+#: src/gtk/devices_view.cpp
+msgid "Neither bud is in."
+msgstr "Geen enkel oordopje is in."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Volledige modus — berichten, contacten en meldingen."
@@ -1798,6 +1830,30 @@ msgstr "Zoek apparaten"
msgid "Listening mode"
msgstr "Luistermodus"
+#: src/gtk/devices_view.cpp
+msgid "In-ear detection"
+msgstr "Draagdetectie"
+
+#: src/gtk/devices_view.cpp
+msgid "Pause playback when:"
+msgstr "Weergave pauzeren wanneer:"
+
+#: src/gtk/devices_view.cpp
+msgid "Never"
+msgstr "Nooit"
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is removed"
+msgstr "Eén oordopje wordt uitgenomen"
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are removed"
+msgstr "Beide oordopjes worden uitgenomen"
+
+#: src/gtk/devices_view.cpp
+msgid "Pauses whatever is playing on this computer, and starts it again when the buds go back in. Only playback Tether paused is resumed."
+msgstr "Pauzeert wat er op deze computer speelt en start het weer wanneer de oordopjes terug in gaan. Alleen weergave die Tether pauzeerde wordt hervat."
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth vereist een eenmalige systeeminstelling"
diff --git a/po/pl.po b/po/pl.po
index 4e6be78..b4fbb7c 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-08 16:30-0700\n"
+"POT-Creation-Date: 2026-09-08 16:56-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Polish\n"
@@ -96,6 +96,10 @@ msgstr "Pokaż poziom baterii AirPods i etui."
msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
msgstr "Ustaw tryb słuchania AirPods: off, anc, transparency, adaptive."
+#: src/cli/main.cpp
+msgid "Pause local playback when an AirPod is removed: never, one-removed, both-removed."
+msgstr "Wstrzymaj lokalne odtwarzanie po wyjęciu AirPoda: never, one-removed, both-removed."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Wypisz rozmowy z wiadomościami z iPhone'a."
@@ -465,6 +469,10 @@ msgstr "Prawa"
msgid "Case"
msgstr "Etui"
+#: src/cli/main.cpp
+msgid "Worn"
+msgstr "Noszone"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Nie udało się połączyć z demonem.\n"
@@ -478,6 +486,14 @@ msgstr "Tryb słuchania ustawiony na %s.\n"
msgid "The listening mode could not be set."
msgstr "Nie można ustawić trybu słuchania."
+#: src/cli/main.cpp
+msgid "Use never, one-removed or both-removed.\n"
+msgstr "Użyj never, one-removed lub both-removed.\n"
+
+#: src/cli/main.cpp
+msgid "Pause on removal set to %s.\n"
+msgstr "Wstrzymanie przy wyjęciu ustawione na %s.\n"
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Demon zamknął połączenie, zanim operacja się zakończyła.\n"
@@ -1503,6 +1519,22 @@ msgstr "Redukcja szumów"
msgid "These AirPods do not report a listening mode."
msgstr "Te AirPods nie zgłaszają trybu słuchania."
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report whether they are being worn."
+msgstr "Te AirPods nie zgłaszają, czy są noszone."
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are in."
+msgstr "Obie słuchawki są w uszach."
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is in."
+msgstr "Jedna słuchawka jest w uchu."
+
+#: src/gtk/devices_view.cpp
+msgid "Neither bud is in."
+msgstr "Żadna słuchawka nie jest w uchu."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Tryb pełny — wiadomości, kontakty i powiadomienia."
@@ -1798,6 +1830,30 @@ msgstr "Szukaj urządzeń"
msgid "Listening mode"
msgstr "Tryb słuchania"
+#: src/gtk/devices_view.cpp
+msgid "In-ear detection"
+msgstr "Wykrywanie w uchu"
+
+#: src/gtk/devices_view.cpp
+msgid "Pause playback when:"
+msgstr "Wstrzymaj odtwarzanie, gdy:"
+
+#: src/gtk/devices_view.cpp
+msgid "Never"
+msgstr "Nigdy"
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is removed"
+msgstr "Wyjęta zostanie jedna słuchawka"
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are removed"
+msgstr "Wyjęte zostaną obie słuchawki"
+
+#: src/gtk/devices_view.cpp
+msgid "Pauses whatever is playing on this computer, and starts it again when the buds go back in. Only playback Tether paused is resumed."
+msgstr "Wstrzymuje to, co jest odtwarzane na tym komputerze, i uruchamia ponownie, gdy słuchawki wrócą do uszu. Wznawiane jest tylko odtwarzanie wstrzymane przez Tether."
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth wymaga jednorazowej konfiguracji systemu"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 670a7fa..e07aa68 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-08 16:30-0700\n"
+"POT-Creation-Date: 2026-09-08 16:56-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Brazilian Portuguese\n"
@@ -97,6 +97,10 @@ msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
msgstr ""
"Definir o modo de escuta dos AirPods: off, anc, transparency, adaptive."
+#: src/cli/main.cpp
+msgid "Pause local playback when an AirPod is removed: never, one-removed, both-removed."
+msgstr "Pausar a reprodução local ao remover um AirPod: never, one-removed, both-removed."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Listar as conversas de mensagens do iPhone."
@@ -461,6 +465,10 @@ msgstr "Dir."
msgid "Case"
msgstr "Estojo"
+#: src/cli/main.cpp
+msgid "Worn"
+msgstr "Em uso"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Não foi possível alcançar o daemon.\n"
@@ -474,6 +482,14 @@ msgstr "Modo de escuta definido como %s.\n"
msgid "The listening mode could not be set."
msgstr "Não foi possível definir o modo de escuta."
+#: src/cli/main.cpp
+msgid "Use never, one-removed or both-removed.\n"
+msgstr "Use never, one-removed ou both-removed.\n"
+
+#: src/cli/main.cpp
+msgid "Pause on removal set to %s.\n"
+msgstr "Pausa ao remover definida como %s.\n"
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "O daemon fechou a conexão antes de a operação terminar.\n"
@@ -1505,6 +1521,22 @@ msgstr "Cancelamento de ruído"
msgid "These AirPods do not report a listening mode."
msgstr "Estes AirPods não informam um modo de escuta."
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report whether they are being worn."
+msgstr "Estes AirPods não informam se estão sendo usados."
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are in."
+msgstr "Os dois fones estão colocados."
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is in."
+msgstr "Um fone está colocado."
+
+#: src/gtk/devices_view.cpp
+msgid "Neither bud is in."
+msgstr "Nenhum fone está colocado."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Modo completo — mensagens, contatos e notificações."
@@ -1801,6 +1833,30 @@ msgstr "Procurar dispositivos"
msgid "Listening mode"
msgstr "Modo de escuta"
+#: src/gtk/devices_view.cpp
+msgid "In-ear detection"
+msgstr "Detecção de uso"
+
+#: src/gtk/devices_view.cpp
+msgid "Pause playback when:"
+msgstr "Pausar a reprodução quando:"
+
+#: src/gtk/devices_view.cpp
+msgid "Never"
+msgstr "Nunca"
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is removed"
+msgstr "Um fone for removido"
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are removed"
+msgstr "Os dois fones forem removidos"
+
+#: src/gtk/devices_view.cpp
+msgid "Pauses whatever is playing on this computer, and starts it again when the buds go back in. Only playback Tether paused is resumed."
+msgstr "Pausa o que estiver tocando neste computador e retoma quando os fones voltarem aos ouvidos. Só é retomada a reprodução que o Tether pausou."
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "O Bluetooth precisa de uma configuração única do sistema"
diff --git a/po/ru.po b/po/ru.po
index b72cefd..e47d37e 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-08 16:30-0700\n"
+"POT-Creation-Date: 2026-09-08 16:56-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Russian\n"
@@ -96,6 +96,10 @@ msgstr "Показать заряд AirPods и футляра."
msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
msgstr "Задать режим прослушивания AirPods: off, anc, transparency, adaptive."
+#: src/cli/main.cpp
+msgid "Pause local playback when an AirPod is removed: never, one-removed, both-removed."
+msgstr "Ставить локальное воспроизведение на паузу при извлечении AirPod: never, one-removed, both-removed."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Показать переписки с сообщениями на iPhone."
@@ -465,6 +469,10 @@ msgstr "Правый"
msgid "Case"
msgstr "Футляр"
+#: src/cli/main.cpp
+msgid "Worn"
+msgstr "В ушах"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Не удалось связаться с демоном.\n"
@@ -478,6 +486,14 @@ msgstr "Режим прослушивания установлен на %s.\n"
msgid "The listening mode could not be set."
msgstr "Не удалось задать режим прослушивания."
+#: src/cli/main.cpp
+msgid "Use never, one-removed or both-removed.\n"
+msgstr "Используйте never, one-removed или both-removed.\n"
+
+#: src/cli/main.cpp
+msgid "Pause on removal set to %s.\n"
+msgstr "Пауза при извлечении установлена на %s.\n"
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Демон закрыл соединение до завершения операции.\n"
@@ -1501,6 +1517,22 @@ msgstr "Шумоподавление"
msgid "These AirPods do not report a listening mode."
msgstr "Эти AirPods не сообщают режим прослушивания."
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report whether they are being worn."
+msgstr "Эти AirPods не сообщают, надеты ли они."
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are in."
+msgstr "Оба наушника в ушах."
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is in."
+msgstr "Один наушник в ухе."
+
+#: src/gtk/devices_view.cpp
+msgid "Neither bud is in."
+msgstr "Ни один наушник не в ухе."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Полный режим — сообщения, контакты и уведомления."
@@ -1799,6 +1831,30 @@ msgstr "Искать устройства"
msgid "Listening mode"
msgstr "Режим прослушивания"
+#: src/gtk/devices_view.cpp
+msgid "In-ear detection"
+msgstr "Определение в ухе"
+
+#: src/gtk/devices_view.cpp
+msgid "Pause playback when:"
+msgstr "Ставить на паузу, когда:"
+
+#: src/gtk/devices_view.cpp
+msgid "Never"
+msgstr "Никогда"
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is removed"
+msgstr "Извлечён один наушник"
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are removed"
+msgstr "Извлечены оба наушника"
+
+#: src/gtk/devices_view.cpp
+msgid "Pauses whatever is playing on this computer, and starts it again when the buds go back in. Only playback Tether paused is resumed."
+msgstr "Ставит на паузу то, что воспроизводится на этом компьютере, и запускает снова, когда наушники возвращаются в уши. Возобновляется только воспроизведение, поставленное на паузу Tether."
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth требует разовой настройки системы"
diff --git a/po/sv.po b/po/sv.po
index 5383e6f..6171a9f 100644
--- a/po/sv.po
+++ b/po/sv.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-08 16:30-0700\n"
+"POT-Creation-Date: 2026-09-08 16:56-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Swedish\n"
@@ -96,6 +96,10 @@ msgstr "Visa batterinivå för AirPods och etui."
msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
msgstr "Ställ in AirPods lyssningsläge: off, anc, transparency, adaptive."
+#: src/cli/main.cpp
+msgid "Pause local playback when an AirPod is removed: never, one-removed, both-removed."
+msgstr "Pausa lokal uppspelning när en AirPod tas ur: never, one-removed, both-removed."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Lista iPhonens meddelandekonversationer."
@@ -458,6 +462,10 @@ msgstr "Höger"
msgid "Case"
msgstr "Etui"
+#: src/cli/main.cpp
+msgid "Worn"
+msgstr "Bärs"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Kunde inte nå demonen.\n"
@@ -471,6 +479,14 @@ msgstr "Lyssningsläget är inställt på %s.\n"
msgid "The listening mode could not be set."
msgstr "Lyssningsläget kunde inte ställas in."
+#: src/cli/main.cpp
+msgid "Use never, one-removed or both-removed.\n"
+msgstr "Använd never, one-removed eller both-removed.\n"
+
+#: src/cli/main.cpp
+msgid "Pause on removal set to %s.\n"
+msgstr "Paus vid urtagning inställd på %s.\n"
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Demonen stängde anslutningen innan åtgärden var klar.\n"
@@ -1485,6 +1501,22 @@ msgstr "Brusreducering"
msgid "These AirPods do not report a listening mode."
msgstr "De här AirPods rapporterar inget lyssningsläge."
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report whether they are being worn."
+msgstr "De här AirPods rapporterar inte om de bärs."
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are in."
+msgstr "Båda propparna sitter i."
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is in."
+msgstr "En propp sitter i."
+
+#: src/gtk/devices_view.cpp
+msgid "Neither bud is in."
+msgstr "Ingen propp sitter i."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Fullt läge — meddelanden, kontakter och aviseringar."
@@ -1780,6 +1812,30 @@ msgstr "Sök efter enheter"
msgid "Listening mode"
msgstr "Lyssningsläge"
+#: src/gtk/devices_view.cpp
+msgid "In-ear detection"
+msgstr "Bärdetektering"
+
+#: src/gtk/devices_view.cpp
+msgid "Pause playback when:"
+msgstr "Pausa uppspelning när:"
+
+#: src/gtk/devices_view.cpp
+msgid "Never"
+msgstr "Aldrig"
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is removed"
+msgstr "En propp tas ur"
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are removed"
+msgstr "Båda propparna tas ur"
+
+#: src/gtk/devices_view.cpp
+msgid "Pauses whatever is playing on this computer, and starts it again when the buds go back in. Only playback Tether paused is resumed."
+msgstr "Pausar det som spelas på den här datorn och startar det igen när propparna sätts i. Endast uppspelning som Tether pausat återupptas."
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth kräver en engångsinställning av systemet"
diff --git a/po/tether.pot b/po/tether.pot
index 11b369b..95442e3 100644
--- a/po/tether.pot
+++ b/po/tether.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether 0.2.27\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-08 16:30-0700\n"
+"POT-Creation-Date: 2026-09-08 16:56-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
@@ -94,6 +94,12 @@ msgstr ""
msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
msgstr ""
+#: src/cli/main.cpp
+msgid ""
+"Pause local playback when an AirPod is removed: never, one-removed, both-"
+"removed."
+msgstr ""
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr ""
@@ -419,6 +425,10 @@ msgstr ""
msgid "Case"
msgstr ""
+#: src/cli/main.cpp
+msgid "Worn"
+msgstr ""
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr ""
@@ -432,6 +442,15 @@ msgstr ""
msgid "The listening mode could not be set."
msgstr ""
+#: src/cli/main.cpp
+msgid "Use never, one-removed or both-removed.\n"
+msgstr ""
+
+#: src/cli/main.cpp
+#, c-format
+msgid "Pause on removal set to %s.\n"
+msgstr ""
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr ""
@@ -1356,6 +1375,22 @@ msgstr ""
msgid "These AirPods do not report a listening mode."
msgstr ""
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report whether they are being worn."
+msgstr ""
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are in."
+msgstr ""
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is in."
+msgstr ""
+
+#: src/gtk/devices_view.cpp
+msgid "Neither bud is in."
+msgstr ""
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr ""
@@ -1622,6 +1657,32 @@ msgstr ""
msgid "Listening mode"
msgstr ""
+#: src/gtk/devices_view.cpp
+msgid "In-ear detection"
+msgstr ""
+
+#: src/gtk/devices_view.cpp
+msgid "Pause playback when:"
+msgstr ""
+
+#: src/gtk/devices_view.cpp
+msgid "Never"
+msgstr ""
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is removed"
+msgstr ""
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are removed"
+msgstr ""
+
+#: src/gtk/devices_view.cpp
+msgid ""
+"Pauses whatever is playing on this computer, and starts it again when the "
+"buds go back in. Only playback Tether paused is resumed."
+msgstr ""
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr ""
diff --git a/po/tr.po b/po/tr.po
index e9260c2..e06aefa 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-08 16:30-0700\n"
+"POT-Creation-Date: 2026-09-08 16:56-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Turkish\n"
@@ -94,6 +94,10 @@ msgstr "AirPods ve kutu pil durumunu göster."
msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
msgstr "AirPods dinleme modunu ayarla: off, anc, transparency, adaptive."
+#: src/cli/main.cpp
+msgid "Pause local playback when an AirPod is removed: never, one-removed, both-removed."
+msgstr "Bir AirPod çıkarıldığında yerel oynatmayı duraklat: never, one-removed, both-removed."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "iPhone'daki mesaj konuşmalarını listele."
@@ -459,6 +463,10 @@ msgstr "Sağ"
msgid "Case"
msgstr "Kutu"
+#: src/cli/main.cpp
+msgid "Worn"
+msgstr "Takılı"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Arka plan hizmetine ulaşılamadı.\n"
@@ -472,6 +480,14 @@ msgstr "Dinleme modu %s olarak ayarlandı.\n"
msgid "The listening mode could not be set."
msgstr "Dinleme modu ayarlanamadı."
+#: src/cli/main.cpp
+msgid "Use never, one-removed or both-removed.\n"
+msgstr "never, one-removed veya both-removed kullanın.\n"
+
+#: src/cli/main.cpp
+msgid "Pause on removal set to %s.\n"
+msgstr "Çıkarınca duraklatma %s olarak ayarlandı.\n"
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Arka plan hizmeti, işlem bitmeden bağlantıyı kapattı.\n"
@@ -1485,6 +1501,22 @@ msgstr "Gürültü Engelleme"
msgid "These AirPods do not report a listening mode."
msgstr "Bu AirPods bir dinleme modu bildirmiyor."
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report whether they are being worn."
+msgstr "Bu AirPods takılı olup olmadığını bildirmiyor."
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are in."
+msgstr "Her iki kulaklık da takılı."
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is in."
+msgstr "Bir kulaklık takılı."
+
+#: src/gtk/devices_view.cpp
+msgid "Neither bud is in."
+msgstr "Hiçbir kulaklık takılı değil."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Tam kip — mesajlar, kişiler ve bildirimler."
@@ -1776,6 +1808,30 @@ msgstr "Aygıtları tara"
msgid "Listening mode"
msgstr "Dinleme modu"
+#: src/gtk/devices_view.cpp
+msgid "In-ear detection"
+msgstr "Kulakta algılama"
+
+#: src/gtk/devices_view.cpp
+msgid "Pause playback when:"
+msgstr "Şu durumda oynatmayı duraklat:"
+
+#: src/gtk/devices_view.cpp
+msgid "Never"
+msgstr "Asla"
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is removed"
+msgstr "Bir kulaklık çıkarıldığında"
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are removed"
+msgstr "Her iki kulaklık da çıkarıldığında"
+
+#: src/gtk/devices_view.cpp
+msgid "Pauses whatever is playing on this computer, and starts it again when the buds go back in. Only playback Tether paused is resumed."
+msgstr "Bu bilgisayarda çalan her şeyi duraklatır ve kulaklıklar geri takıldığında yeniden başlatır. Yalnızca Tether tarafından duraklatılan oynatma sürdürülür."
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth tek seferlik sistem kurulumu gerektiriyor"
diff --git a/po/uk.po b/po/uk.po
index 79b401a..0f1f44b 100644
--- a/po/uk.po
+++ b/po/uk.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-08 16:30-0700\n"
+"POT-Creation-Date: 2026-09-08 16:56-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Ukrainian\n"
@@ -98,6 +98,10 @@ msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
msgstr ""
"Задати режим прослуховування AirPods: off, anc, transparency, adaptive."
+#: src/cli/main.cpp
+msgid "Pause local playback when an AirPod is removed: never, one-removed, both-removed."
+msgstr "Ставити локальне відтворення на паузу при вийманні AirPod: never, one-removed, both-removed."
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "Показати розмови з повідомленнями на iPhone."
@@ -466,6 +470,10 @@ msgstr "Правий"
msgid "Case"
msgstr "Футляр"
+#: src/cli/main.cpp
+msgid "Worn"
+msgstr "У вухах"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "Не вдалося зв'язатися з демоном.\n"
@@ -479,6 +487,14 @@ msgstr "Режим прослуховування встановлено на %s
msgid "The listening mode could not be set."
msgstr "Не вдалося задати режим прослуховування."
+#: src/cli/main.cpp
+msgid "Use never, one-removed or both-removed.\n"
+msgstr "Використовуйте never, one-removed або both-removed.\n"
+
+#: src/cli/main.cpp
+msgid "Pause on removal set to %s.\n"
+msgstr "Паузу при вийманні встановлено на %s.\n"
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "Демон закрив з'єднання до завершення операції.\n"
@@ -1500,6 +1516,22 @@ msgstr "Шумозаглушення"
msgid "These AirPods do not report a listening mode."
msgstr "Ці AirPods не повідомляють режим прослуховування."
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report whether they are being worn."
+msgstr "Ці AirPods не повідомляють, чи їх надіто."
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are in."
+msgstr "Обидва навушники у вухах."
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is in."
+msgstr "Один навушник у вусі."
+
+#: src/gtk/devices_view.cpp
+msgid "Neither bud is in."
+msgstr "Жоден навушник не у вусі."
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "Повний режим — повідомлення, контакти та сповіщення."
@@ -1797,6 +1829,30 @@ msgstr "Шукати пристрої"
msgid "Listening mode"
msgstr "Режим прослуховування"
+#: src/gtk/devices_view.cpp
+msgid "In-ear detection"
+msgstr "Виявлення у вусі"
+
+#: src/gtk/devices_view.cpp
+msgid "Pause playback when:"
+msgstr "Ставити на паузу, коли:"
+
+#: src/gtk/devices_view.cpp
+msgid "Never"
+msgstr "Ніколи"
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is removed"
+msgstr "Вийнято один навушник"
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are removed"
+msgstr "Вийнято обидва навушники"
+
+#: src/gtk/devices_view.cpp
+msgid "Pauses whatever is playing on this computer, and starts it again when the buds go back in. Only playback Tether paused is resumed."
+msgstr "Ставить на паузу те, що відтворюється на цьому комп’ютері, і запускає знову, коли навушники повертаються у вуха. Відновлюється лише відтворення, поставлене на паузу Tether."
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "Bluetooth потребує одноразового налаштування системи"
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 2529978..b550548 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tether\n"
"Report-Msgid-Bugs-To: [email protected]\n"
-"POT-Creation-Date: 2026-09-08 16:30-0700\n"
+"POT-Creation-Date: 2026-09-08 16:56-0700\n"
"PO-Revision-Date: 2026-08-23\n"
"Last-Translator: Tether project\n"
"Language-Team: Simplified Chinese\n"
@@ -94,6 +94,10 @@ msgstr "显示 AirPods 和充电盒电量。"
msgid "Set the AirPods listening mode: off, anc, transparency, adaptive."
msgstr "设置 AirPods 聆听模式:off、anc、transparency、adaptive。"
+#: src/cli/main.cpp
+msgid "Pause local playback when an AirPod is removed: never, one-removed, both-removed."
+msgstr "取下 AirPod 时暂停本机播放:never、one-removed、both-removed。"
+
#: src/cli/main.cpp
msgid "List iPhone message conversations."
msgstr "列出 iPhone 的信息会话。"
@@ -442,6 +446,10 @@ msgstr "右"
msgid "Case"
msgstr "充电盒"
+#: src/cli/main.cpp
+msgid "Worn"
+msgstr "佩戴"
+
#: src/cli/main.cpp
msgid "Could not reach the daemon.\n"
msgstr "无法连接到守护进程。\n"
@@ -455,6 +463,14 @@ msgstr "聆听模式已设为 %s。\n"
msgid "The listening mode could not be set."
msgstr "无法设置聆听模式。"
+#: src/cli/main.cpp
+msgid "Use never, one-removed or both-removed.\n"
+msgstr "请使用 never、one-removed 或 both-removed。\n"
+
+#: src/cli/main.cpp
+msgid "Pause on removal set to %s.\n"
+msgstr "取下时暂停已设为 %s。\n"
+
#: src/cli/main.cpp
msgid "Daemon closed the connection before the operation finished.\n"
msgstr "操作完成前守护进程已关闭连接。\n"
@@ -1431,6 +1447,22 @@ msgstr "降噪"
msgid "These AirPods do not report a listening mode."
msgstr "此 AirPods 不报告聆听模式。"
+#: src/gtk/devices_view.cpp
+msgid "These AirPods do not report whether they are being worn."
+msgstr "此 AirPods 不报告是否正在佩戴。"
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are in."
+msgstr "两只耳机均已佩戴。"
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is in."
+msgstr "已佩戴一只耳机。"
+
+#: src/gtk/devices_view.cpp
+msgid "Neither bud is in."
+msgstr "未佩戴耳机。"
+
#: src/gtk/devices_view.cpp
msgid "Full mode — messages, contacts, and notifications."
msgstr "完整模式 —— 信息、通讯录和通知。"
@@ -1716,6 +1748,30 @@ msgstr "搜索设备"
msgid "Listening mode"
msgstr "聆听模式"
+#: src/gtk/devices_view.cpp
+msgid "In-ear detection"
+msgstr "入耳检测"
+
+#: src/gtk/devices_view.cpp
+msgid "Pause playback when:"
+msgstr "暂停播放的时机:"
+
+#: src/gtk/devices_view.cpp
+msgid "Never"
+msgstr "从不"
+
+#: src/gtk/devices_view.cpp
+msgid "One bud is removed"
+msgstr "取下一只耳机时"
+
+#: src/gtk/devices_view.cpp
+msgid "Both buds are removed"
+msgstr "取下两只耳机时"
+
+#: src/gtk/devices_view.cpp
+msgid "Pauses whatever is playing on this computer, and starts it again when the buds go back in. Only playback Tether paused is resumed."
+msgstr "暂停本机正在播放的内容,并在耳机重新戴上时继续播放。仅恢复由 Tether 暂停的播放。"
+
#: src/gtk/devices_view.cpp
msgid "Bluetooth needs one-time system setup"
msgstr "蓝牙需要一次性的系统设置"
diff --git a/src/cli/main.cpp b/src/cli/main.cpp
index fa5d037..a09a8e0 100644
--- a/src/cli/main.cpp
+++ b/src/cli/main.cpp
@@ -11,6 +11,7 @@
#include <string>
#include <strings.h>
#include <sys/ioctl.h>
+#include <tether/bluetooth/config.hpp>
#include <tether/client.hpp>
#include <tether/core.hpp>
#include <tether/crypto.hpp>
@@ -192,6 +193,7 @@ static const Opt kOptions[] = {
{"--bt-connection", N_("Show Bluetooth link and profile connection state.")},
{"--bt-airpods", N_("Show AirPods and case battery.")},
{"--bt-airpods-mode", N_("Set the AirPods listening mode: off, anc, transparency, adaptive.")},
+ {"--bt-airpods-pause", N_("Pause local playback when an AirPod is removed: never, one-removed, both-removed.")},
{"--bt-threads", N_("List iPhone message conversations.")},
{"--bt-messages <thread>", N_("Show messages in one conversation.")},
{"--bt-send <thread> <text>", N_("Reply in one conversation.")},
@@ -531,6 +533,13 @@ static int print_bt_airpods(tether::Client& client) {
if (resp.contains("anc") && resp["anc"].is_string())
fprintf(stdout, " %-6s %s\n", _("Mode"), resp["anc"].get<std::string>().c_str());
+ if (resp.contains("ear") && resp["ear"].is_object()) {
+ const std::string primary = resp["ear"].value("primary", "unknown");
+ const std::string secondary = resp["ear"].value("secondary", "unknown");
+ if (primary != "unknown" || secondary != "unknown")
+ fprintf(stdout, " %-6s %s, %s\n", _("Worn"), primary.c_str(), secondary.c_str());
+ }
+
const std::string reason = resp.value("reason", "");
if (!reason.empty())
fprintf(stdout, " %s\n", reason.c_str());
@@ -556,6 +565,19 @@ static int set_bt_airpods_mode(tether::Client& client, const std::string& mode)
return 1;
}
+static int set_bt_airpods_pause(tether::Client& client, const std::string& mode) {
+ if (tether::bluetooth::to_string(tether::bluetooth::pause_mode_from_string(mode)) != mode) {
+ debug::log(ERR, _("Use never, one-removed or both-removed.\n"));
+ return 1;
+ }
+ if (!client.send(nlohmann::json{{"command", "bt_airpods_pause"}, {"mode", mode}}.dump() + "\n")) {
+ debug::log(ERR, _("Could not reach the daemon.\n"));
+ return 1;
+ }
+ fprintf(stdout, _("Pause on removal set to %s.\n"), mode.c_str());
+ return 0;
+}
+
// Pairing takes tens of seconds and reports progress as it goes, so this
// subscribes and streams events until the terminal result arrives.
static int run_bt_transaction(tether::Client& client,
@@ -1009,6 +1031,10 @@ int main(int argc, char* argv[]) {
action = "bt_airpods_mode";
if (i + 1 < argc && argv[i + 1][0] != '-')
arg_val = argv[++i];
+ } else if (arg == "--bt-airpods-pause") {
+ action = "bt_airpods_pause";
+ if (i + 1 < argc && argv[i + 1][0] != '-')
+ arg_val = argv[++i];
} else if (arg == "--bt-diagnostics") {
action = "bt_diagnostics";
} else if (arg == "--bt-threads") {
@@ -1248,6 +1274,8 @@ int main(int argc, char* argv[]) {
return print_bt_airpods(client);
} else if (action == "bt_airpods_mode") {
return set_bt_airpods_mode(client, arg_val);
+ } else if (action == "bt_airpods_pause") {
+ return set_bt_airpods_pause(client, arg_val);
} else if (action == "bt_diagnostics") {
return print_bt_diagnostics(client);
} else if (action == "bt_threads") {
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 662f97d..f2bf324 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -12,6 +12,7 @@ add_library(tether STATIC
src/client.cpp
src/extension_host.cpp
src/discovery.cpp
+ src/mpris.cpp
src/bluetooth/objects.cpp
src/bluetooth/monitor.cpp
src/bluetooth/config.cpp
diff --git a/src/core/include/tether/bluetooth/airpods.hpp b/src/core/include/tether/bluetooth/airpods.hpp
index d8abfe9..4ff060b 100644
--- a/src/core/include/tether/bluetooth/airpods.hpp
+++ b/src/core/include/tether/bluetooth/airpods.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include "tether/bluetooth/config.hpp"
#include "tether/bluetooth/objects.hpp"
#include <cstdint>
@@ -33,6 +34,21 @@ namespace tether::bluetooth {
const char* to_string(AncMode mode);
std::optional<AncMode> anc_mode_from_string(const std::string& name);
+ // Where a bud is.
+ enum class EarStatus { Unknown, InEar, OutOfEar, InCase };
+
+ const char* to_string(EarStatus status);
+
+ struct EarState {
+ EarStatus primary = EarStatus::Unknown;
+ EarStatus secondary = EarStatus::Unknown;
+
+ int in_ear() const { return (primary == EarStatus::InEar ? 1 : 0) + (secondary == EarStatus::InEar ? 1 : 0); }
+ bool known() const { return primary != EarStatus::Unknown || secondary != EarStatus::Unknown; }
+
+ bool operator==(const EarState&) const = default;
+ };
+
struct AirPodsBattery {
// -1 when unknown.
int left = -1;
@@ -73,6 +89,7 @@ namespace tether::bluetooth {
AirPodsBattery battery;
// Unset until the buds report one. Not every model has the feature.
std::optional<AncMode> anc;
+ EarState ear;
AirPodsStatus status = AirPodsStatus::Idle;
// Written for display, shown verbatim.
std::string reason;
@@ -89,10 +106,20 @@ namespace tether::bluetooth {
void merge_battery(AirPodsBattery& into, const BatteryUpdate& update);
+ // Decodes an ear-detection notification, 8 bytes carrying the primary bud at
+ // offset 6 and the secondary at 7.
+ std::optional<EarState> parse_ear(const uint8_t* data, size_t len);
+
// Decodes a listening-mode notification, 11 bytes carrying the mode at offset 7.
// Returns no value for anything else, including an out-of-range mode.
std::optional<AncMode> parse_anc(const uint8_t* data, size_t len);
+ // What an ear-state change should do to local playback.
+ enum class MediaAction { None, Pause, Resume };
+
+ // `holding` is whether the caller has a pause outstanding.
+ MediaAction ear_media_action(const EarState& before, const EarState& after, PauseMode mode, bool holding);
+
// The connected AirPods worth opening a channel to, or null. Only one is
// returned: the channel is single-client and so is the watcher.
const Device* find_airpods(const BluezObjects& objects);
diff --git a/src/core/include/tether/bluetooth/config.hpp b/src/core/include/tether/bluetooth/config.hpp
index 7e15c63..02accc2 100644
--- a/src/core/include/tether/bluetooth/config.hpp
+++ b/src/core/include/tether/bluetooth/config.hpp
@@ -17,6 +17,12 @@ namespace tether::bluetooth {
// prompt, so it stays available as a workaround.
enum class AuthStrategy { ConnectFirst, ExplicitPair };
+ // When taking AirPods out should pause whatever is playing locally.
+ enum class PauseMode { Never, OneRemoved, BothRemoved };
+
+ const char* to_string(PauseMode mode);
+ PauseMode pause_mode_from_string(const std::string& value);
+
// Persisted at ~/.config/tether/bluetooth.json.
struct Config {
// Address of the selected iPhone, e.g. "81:71:C8:30:6A:F3".
@@ -42,6 +48,8 @@ namespace tether::bluetooth {
Retention retention = Retention::Encrypted;
// Whether the daemon shows desktop popups at all.
bool desktop_popups_enabled = true;
+ // Whether removing an AirPod pauses local playback.
+ PauseMode airpods_pause = PauseMode::Never;
bool operator==(const Config&) const = default;
};
diff --git a/src/core/include/tether/mpris.hpp b/src/core/include/tether/mpris.hpp
new file mode 100644
index 0000000..0a80866
--- /dev/null
+++ b/src/core/include/tether/mpris.hpp
@@ -0,0 +1,40 @@
+#pragma once
+
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace tether {
+
+ // Pauses whatever is playing on the desktop and can put it back, over MPRIS on the session bus.
+ class MediaControl {
+ public:
+ MediaControl();
+ ~MediaControl();
+
+ MediaControl(const MediaControl&) = delete;
+ MediaControl& operator=(const MediaControl&) = delete;
+
+ // Pauses every player currently reporting Playing and remembers which
+ // ones, so resume() can put them back. Returns how many were
+ // paused. Does nothing while already holding a pause.
+ size_t pause();
+
+ // Plays what this object paused, then forgets them.
+ size_t resume();
+
+ // Whether anything is currently paused by this object.
+ bool holding() const;
+
+ // Drops the remembered players without touching them.
+ void forget();
+
+ // Bus names of every MPRIS player currently reporting Playing.
+ std::vector<std::string> playing() const;
+
+ private:
+ struct Impl;
+ std::unique_ptr<Impl> impl_;
+ };
+
+} // namespace tether
diff --git a/src/core/src/bluetooth/airpods.cpp b/src/core/src/bluetooth/airpods.cpp
index 7bbe507..1e21f20 100644
--- a/src/core/src/bluetooth/airpods.cpp
+++ b/src/core/src/bluetooth/airpods.cpp
@@ -71,6 +71,10 @@ namespace tether::bluetooth {
// Listening mode, sent and received on the same 11-byte:
// 04 00 04 00 09 00 0D [mode] 00 00 00
+ // Ear detection: 04 00 04 00 06 00 [primary] [secondary]
+ constexpr uint8_t EAR_PREFIX[] = {0x04, 0x00, 0x04, 0x00, 0x06, 0x00};
+ constexpr size_t EAR_PACKET_BYTES = 8;
+
constexpr uint8_t ANC_PREFIX[] = {0x04, 0x00, 0x04, 0x00, 0x09, 0x00, 0x0d};
constexpr size_t ANC_PACKET_BYTES = 11;
constexpr size_t ANC_MODE_OFFSET = 7;
@@ -152,6 +156,8 @@ namespace tether::bluetooth {
{"right", s.battery.right},
{"case", s.battery.case_},
{"anc", s.anc ? nlohmann::json(to_string(*s.anc)) : nlohmann::json()},
+ {"ear", {{"primary", to_string(s.ear.primary)}, {"secondary", to_string(s.ear.secondary)}}},
+ {"in_ear", s.ear.in_ear()},
{"status", to_string(s.status)},
{"reason", s.reason},
};
@@ -178,6 +184,41 @@ namespace tether::bluetooth {
return std::nullopt;
}
+ const char* to_string(EarStatus status) {
+ switch (status) {
+ case EarStatus::Unknown:
+ return "unknown";
+ case EarStatus::InEar:
+ return "in_ear";
+ case EarStatus::OutOfEar:
+ return "out_of_ear";
+ case EarStatus::InCase:
+ return "in_case";
+ }
+ return "unknown";
+ }
+
+ std::optional<EarState> parse_ear(const uint8_t* data, size_t len) {
+ if (data == nullptr || len != EAR_PACKET_BYTES)
+ return std::nullopt;
+ if (std::memcmp(data, EAR_PREFIX, sizeof(EAR_PREFIX)) != 0)
+ return std::nullopt;
+
+ const auto decode = [](uint8_t byte) {
+ switch (byte) {
+ case 0x00:
+ return EarStatus::InEar;
+ case 0x01:
+ return EarStatus::OutOfEar;
+ case 0x02:
+ return EarStatus::InCase;
+ default:
+ return EarStatus::Unknown;
+ }
+ };
+ return EarState{decode(data[6]), decode(data[7])};
+ }
+
std::optional<AncMode> parse_anc(const uint8_t* data, size_t len) {
if (data == nullptr || len != ANC_PACKET_BYTES)
return std::nullopt;
@@ -228,6 +269,23 @@ namespace tether::bluetooth {
return update;
}
+ MediaAction ear_media_action(const EarState& before, const EarState& after, PauseMode mode, bool holding) {
+ if (mode == PauseMode::Never)
+ return MediaAction::None;
+ if (!before.known() || !after.known() || before == after)
+ return MediaAction::None;
+
+ const int needed = mode == PauseMode::OneRemoved ? 2 : 1;
+ const bool worn_before = before.in_ear() >= needed;
+ const bool worn_after = after.in_ear() >= needed;
+
+ if (worn_before && !worn_after)
+ return MediaAction::Pause;
+ if (!worn_before && worn_after && holding)
+ return MediaAction::Resume;
+ return MediaAction::None;
+ }
+
const Device* find_airpods(const BluezObjects& objects) {
for (const auto& device : objects.devices)
if (device.connected && device.looks_like_airpods())
@@ -403,6 +461,15 @@ namespace tether::bluetooth {
continue;
}
+ if (auto ear = parse_ear(buffer.data(), size)) {
+ {
+ std::lock_guard<std::mutex> lock(mutex);
+ state.ear = *ear;
+ }
+ publish(delivered ? AirPodsStatus::Live : AirPodsStatus::Connecting, "");
+ continue;
+ }
+
auto update = parse_battery(buffer.data(), size);
if (!update)
continue;
@@ -445,6 +512,7 @@ namespace tether::bluetooth {
state.name.clear();
state.battery = {};
state.anc.reset();
+ state.ear = {};
}
publish(AirPodsStatus::Idle, "");
backoff_ms = BACKOFF_START_MS;
@@ -460,6 +528,7 @@ namespace tether::bluetooth {
state.address = address;
state.battery = {};
state.anc.reset();
+ state.ear = {};
}
state.name = name;
}
diff --git a/src/core/src/bluetooth/config.cpp b/src/core/src/bluetooth/config.cpp
index 6b1b31d..501aa2e 100644
--- a/src/core/src/bluetooth/config.cpp
+++ b/src/core/src/bluetooth/config.cpp
@@ -23,6 +23,26 @@ namespace tether::bluetooth {
return value == "explicit-pair" ? AuthStrategy::ExplicitPair : AuthStrategy::ConnectFirst;
}
+ const char* to_string(PauseMode mode) {
+ switch (mode) {
+ case PauseMode::Never:
+ return "never";
+ case PauseMode::OneRemoved:
+ return "one-removed";
+ case PauseMode::BothRemoved:
+ return "both-removed";
+ }
+ return "never";
+ }
+
+ PauseMode pause_mode_from_string(const std::string& value) {
+ if (value == "one-removed")
+ return PauseMode::OneRemoved;
+ if (value == "both-removed")
+ return PauseMode::BothRemoved;
+ return PauseMode::Never;
+ }
+
std::string config_path() {
const std::filesystem::path dir = paths::config_dir();
if (dir.empty())
@@ -43,6 +63,7 @@ namespace tether::bluetooth {
j["adapter"] = config.adapter;
j["retention"] = to_string(config.retention);
j["desktop_popups_enabled"] = config.desktop_popups_enabled;
+ j["airpods_pause"] = to_string(config.airpods_pause);
return j.dump(2);
}
@@ -63,6 +84,7 @@ namespace tether::bluetooth {
config.adapter = j.value("adapter", "");
config.retention = retention_from_string(j.value("retention", "encrypted"));
config.desktop_popups_enabled = j.value("desktop_popups_enabled", true);
+ config.airpods_pause = pause_mode_from_string(j.value("airpods_pause", ""));
} catch (const std::exception&) {
// A corrupt file must not stop the daemon; defaults are safe.
}
diff --git a/src/core/src/mpris.cpp b/src/core/src/mpris.cpp
new file mode 100644
index 0000000..154f918
--- /dev/null
+++ b/src/core/src/mpris.cpp
@@ -0,0 +1,194 @@
+#include "tether/mpris.hpp"
+
+#include <tether/log.hpp>
+
+#include <gio/gio.h>
+#include <mutex>
+
+namespace tether {
+
+ namespace {
+
+ constexpr const char* MPRIS_PREFIX = "org.mpris.MediaPlayer2.";
+ constexpr const char* MPRIS_PATH = "/org/mpris/MediaPlayer2";
+ constexpr const char* PLAYER_IFACE = "org.mpris.MediaPlayer2.Player";
+
+ constexpr int CALL_TIMEOUT_MS = 1000;
+
+ std::string playback_status(GDBusConnection* bus, const std::string& name) {
+ GError* error = nullptr;
+ GVariant* reply = g_dbus_connection_call_sync(bus,
+ name.c_str(),
+ MPRIS_PATH,
+ "org.freedesktop.DBus.Properties",
+ "Get",
+ g_variant_new("(ss)", PLAYER_IFACE, "PlaybackStatus"),
+ G_VARIANT_TYPE("(v)"),
+ G_DBUS_CALL_FLAGS_NO_AUTO_START,
+ CALL_TIMEOUT_MS,
+ nullptr,
+ &error);
+ if (!reply) {
+ g_clear_error(&error);
+ return {};
+ }
+
+ GVariant* boxed = nullptr;
+ g_variant_get(reply, "(v)", &boxed);
+ std::string status;
+ if (boxed) {
+ if (const char* text = g_variant_get_string(boxed, nullptr))
+ status = text;
+ g_variant_unref(boxed);
+ }
+ g_variant_unref(reply);
+ return status;
+ }
+
+ bool call_player(GDBusConnection* bus, const std::string& name, const char* method) {
+ GError* error = nullptr;
+ GVariant* reply = g_dbus_connection_call_sync(bus,
+ name.c_str(),
+ MPRIS_PATH,
+ PLAYER_IFACE,
+ method,
+ nullptr,
+ nullptr,
+ G_DBUS_CALL_FLAGS_NO_AUTO_START,
+ CALL_TIMEOUT_MS,
+ nullptr,
+ &error);
+ if (!reply) {
+ debug::log(DEBUG, "mpris: {} on {} failed: {}", method, name, error ? error->message : "unknown");
+ g_clear_error(&error);
+ return false;
+ }
+ g_variant_unref(reply);
+ return true;
+ }
+
+ } // namespace
+
+ struct MediaControl::Impl {
+ mutable std::mutex mutex;
+ std::vector<std::string> paused;
+
+ // Resolved on first use: the daemon starts before the session bus is necessarily interesting.
+ GDBusConnection* bus() const {
+ static GDBusConnection* connection = [] {
+ GError* error = nullptr;
+ GDBusConnection* c = g_bus_get_sync(G_BUS_TYPE_SESSION, nullptr, &error);
+ if (!c) {
+ debug::log(DEBUG, "mpris: no session bus: {}", error ? error->message : "unknown");
+ g_clear_error(&error);
+ }
+ return c;
+ }();
+ return connection;
+ }
+
+ std::vector<std::string> players() const {
+ GDBusConnection* connection = bus();
+ if (!connection)
+ return {};
+
+ GError* error = nullptr;
+ GVariant* reply = g_dbus_connection_call_sync(connection,
+ "org.freedesktop.DBus",
+ "/org/freedesktop/DBus",
+ "org.freedesktop.DBus",
+ "ListNames",
+ nullptr,
+ G_VARIANT_TYPE("(as)"),
+ G_DBUS_CALL_FLAGS_NONE,
+ CALL_TIMEOUT_MS,
+ nullptr,
+ &error);
+ if (!reply) {
+ debug::log(DEBUG, "mpris: ListNames failed: {}", error ? error->message : "unknown");
+ g_clear_error(&error);
+ return {};
+ }
+
+ std::vector<std::string> names;
+ GVariantIter* iter = nullptr;
+ const char* name = nullptr;
+ g_variant_get(reply, "(as)", &iter);
+ while (g_variant_iter_next(iter, "&s", &name)) {
+ if (g_str_has_prefix(name, MPRIS_PREFIX))
+ names.emplace_back(name);
+ }
+ g_variant_iter_free(iter);
+ g_variant_unref(reply);
+ return names;
+ }
+ };
+
+ MediaControl::MediaControl() : impl_(std::make_unique<Impl>()) {}
+ MediaControl::~MediaControl() = default;
+
+ std::vector<std::string> MediaControl::playing() const {
+ GDBusConnection* bus = impl_->bus();
+ if (!bus)
+ return {};
+
+ std::vector<std::string> result;
+ for (const auto& name : impl_->players()) {
+ if (playback_status(bus, name) == "Playing")
+ result.push_back(name);
+ }
+ return result;
+ }
+
+ size_t MediaControl::pause() {
+ GDBusConnection* bus = impl_->bus();
+ if (!bus)
+ return 0;
+ {
+ std::lock_guard<std::mutex> lock(impl_->mutex);
+ if (!impl_->paused.empty())
+ return 0;
+ }
+
+ std::vector<std::string> held;
+ for (const auto& name : playing()) {
+ if (call_player(bus, name, "Pause"))
+ held.push_back(name);
+ }
+ if (held.empty())
+ return 0;
+
+ std::lock_guard<std::mutex> lock(impl_->mutex);
+ impl_->paused = std::move(held);
+ return impl_->paused.size();
+ }
+
+ size_t MediaControl::resume() {
+ GDBusConnection* bus = impl_->bus();
+ std::vector<std::string> held;
+ {
+ std::lock_guard<std::mutex> lock(impl_->mutex);
+ held.swap(impl_->paused);
+ }
+ if (!bus)
+ return 0;
+
+ size_t resumed = 0;
+ for (const auto& name : held) {
+ if (call_player(bus, name, "Play"))
+ ++resumed;
+ }
+ return resumed;
+ }
+
+ bool MediaControl::holding() const {
+ std::lock_guard<std::mutex> lock(impl_->mutex);
+ return !impl_->paused.empty();
+ }
+
+ void MediaControl::forget() {
+ std::lock_guard<std::mutex> lock(impl_->mutex);
+ impl_->paused.clear();
+ }
+
+} // namespace tether
diff --git a/src/core/src/net.cpp b/src/core/src/net.cpp
index 81d609e..36ae9dd 100644
--- a/src/core/src/net.cpp
+++ b/src/core/src/net.cpp
@@ -310,6 +310,7 @@ namespace tether {
status["retention"] = to_string(config.retention);
status["retention_ready"] = secret::have_key();
status["desktop_popups_enabled"] = config.desktop_popups_enabled;
+ status["airpods_pause"] = to_string(config.airpods_pause);
status["version"] = TETHER_VERSION;
if (!bluetooth::g_bluez) {
status["capability"] = nullptr;
@@ -958,6 +959,12 @@ namespace tether {
std::string payload = build_bt_airpods().dump() + "\n";
write_plain_packet(client_fd, payload);
continue;
+ } else if (j.contains("command") && j["command"] == "bt_airpods_pause" && j.contains("mode")) {
+ auto config = bluetooth::load_config();
+ config.airpods_pause = bluetooth::pause_mode_from_string(j["mode"]);
+ bluetooth::save_config(config);
+ broadcast_local_event(build_bt_status().dump());
+ continue;
} else if (j.contains("command") && j["command"] == "bt_airpods_mode" && j.contains("mode")) {
const auto mode = bluetooth::anc_mode_from_string(j.value("mode", ""));
nlohmann::json reply;
diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp
index 69b208e..82b4f15 100644
--- a/src/daemon/main.cpp
+++ b/src/daemon/main.cpp
@@ -17,6 +17,7 @@
#include <tether/file_transfer.hpp>
#include <tether/i18n.hpp>
#include <tether/log.hpp>
+#include <tether/mpris.hpp>
#include <tether/net.hpp>
#include <tether/otp.hpp>
#include <tether/secret_store.hpp>
@@ -248,7 +249,26 @@ int main(int argc, char** argv) {
bluez.set_preferred_adapter(bt_config.adapter);
// AirPods battery arrives on its own L2CAP channel, not through BlueZ.
- tether::bluetooth::AirPodsWatcher airpods([](const tether::bluetooth::AirPodsState& state) {
+ tether::MediaControl media;
+ tether::bluetooth::EarState last_ear;
+ tether::bluetooth::AirPodsWatcher airpods([&media, &last_ear](const tether::bluetooth::AirPodsState& state) {
+ const auto mode = tether::bluetooth::load_config().airpods_pause;
+ switch (tether::bluetooth::ear_media_action(last_ear, state.ear, mode, media.holding())) {
+ case tether::bluetooth::MediaAction::Pause:
+ if (const size_t paused = media.pause())
+ debug::log(INFO, "airpods: paused {} player(s), a bud came out", paused);
+ break;
+ case tether::bluetooth::MediaAction::Resume:
+ if (const size_t resumed = media.resume())
+ debug::log(INFO, "airpods: resumed {} player(s), the buds went back in", resumed);
+ break;
+ case tether::bluetooth::MediaAction::None:
+ break;
+ }
+ if (state.address.empty())
+ media.forget();
+ last_ear = state.ear;
+
tether::broadcast_local_event(tether::bluetooth::to_json(state).dump());
});
const auto follow_airpods = [&bluez, &airpods]() {
diff --git a/src/gtk/devices_view.cpp b/src/gtk/devices_view.cpp
index fef2416..d5daa9e 100644
--- a/src/gtk/devices_view.cpp
+++ b/src/gtk/devices_view.cpp
@@ -62,6 +62,8 @@ namespace tether::ui {
GtkWidget* lbl_airpods_name = nullptr;
GtkWidget* lbl_airpods_battery = nullptr;
GtkWidget* lbl_airpods_reason = nullptr;
+ GtkWidget* lbl_airpods_worn = nullptr;
+ GtkWidget* cmb_airpods_pause = nullptr;
GtkWidget* airpods_mode_buttons[4] = {nullptr, nullptr, nullptr, nullptr};
bool airpods_syncing = false;
@@ -229,6 +231,19 @@ namespace tether::ui {
{"anc", N_("Noise Cancellation")},
};
+ // Wire values for the pause-on-removal setting, in the order they appear
+ // in the dropdown.
+ const char* const AIRPODS_PAUSE_MODES[3] = {"never", "one-removed", "both-removed"};
+
+ void on_airpods_pause_changed(GtkWidget* combo, gpointer) {
+ if (g_devices.airpods_syncing)
+ return;
+ const int index = gtk_combo_box_get_active(GTK_COMBO_BOX(combo));
+ if (index < 0 || index > 2)
+ return;
+ daemon_send({{"command", "bt_airpods_pause"}, {"mode", AIRPODS_PAUSE_MODES[index]}});
+ }
+
void on_airpods_mode_toggled(GtkWidget* button, gpointer data) {
if (g_devices.airpods_syncing || !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
return;
@@ -258,6 +273,27 @@ namespace tether::ui {
? _("No AirPods are connected.")
: _("These AirPods do not report a listening mode.");
set_text(g_devices.lbl_airpods_reason, reason);
+
+ // Which bud is "primary" moves between them, so this counts rather
+ // than naming a side.
+ const int in_ear = airpods.value("in_ear", 0);
+ const nlohmann::json ear = airpods.value("ear", nlohmann::json::object());
+ const bool ear_known =
+ ear.value("primary", "unknown") != "unknown" || ear.value("secondary", "unknown") != "unknown";
+ set_text(g_devices.lbl_airpods_worn,
+ !ear_known ? _("These AirPods do not report whether they are being worn.")
+ : in_ear == 2 ? _("Both buds are in.")
+ : in_ear == 1 ? _("One bud is in.")
+ : _("Neither bud is in."));
+
+ const std::string pause = g_devices.bt_status.value("airpods_pause", "never");
+ g_devices.airpods_syncing = true;
+ for (int i = 0; i < 3; ++i) {
+ if (pause == AIRPODS_PAUSE_MODES[i])
+ gtk_combo_box_set_active(GTK_COMBO_BOX(g_devices.cmb_airpods_pause), i);
+ }
+ gtk_widget_set_sensitive(g_devices.cmb_airpods_pause, ear_known);
+ g_devices.airpods_syncing = false;
}
void update_bt_pane() {
@@ -1434,6 +1470,30 @@ namespace tether::ui {
gtk_style_context_add_class(gtk_widget_get_style_context(g_devices.lbl_airpods_reason), "muted");
gtk_box_pack_start(GTK_BOX(airpods_box), g_devices.lbl_airpods_reason, FALSE, FALSE, 0);
+ GtkWidget* lbl_wear_title = gtk_label_new(nullptr);
+ gtk_label_set_xalign(GTK_LABEL(lbl_wear_title), 0.0);
+ set_markup(lbl_wear_title, "<b>" + escape_markup(_("In-ear detection")) + "</b>");
+ gtk_box_pack_start(GTK_BOX(airpods_box), lbl_wear_title, FALSE, FALSE, 0);
+
+ g_devices.lbl_airpods_worn = gtk_label_new(nullptr);
+ gtk_label_set_xalign(GTK_LABEL(g_devices.lbl_airpods_worn), 0.0);
+ gtk_label_set_line_wrap(GTK_LABEL(g_devices.lbl_airpods_worn), TRUE);
+ gtk_style_context_add_class(gtk_widget_get_style_context(g_devices.lbl_airpods_worn), "muted");
+ gtk_box_pack_start(GTK_BOX(airpods_box), g_devices.lbl_airpods_worn, FALSE, FALSE, 0);
+
+ GtkWidget* pause_row = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
+ gtk_box_pack_start(GTK_BOX(pause_row), gtk_label_new(_("Pause playback when:")), FALSE, FALSE, 0);
+ g_devices.cmb_airpods_pause = gtk_combo_box_text_new();
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(g_devices.cmb_airpods_pause), _("Never"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(g_devices.cmb_airpods_pause), _("One bud is removed"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(g_devices.cmb_airpods_pause), _("Both buds are removed"));
+ gtk_widget_set_tooltip_text(g_devices.cmb_airpods_pause,
+ _("Pauses whatever is playing on this computer, and starts it again when the "
+ "buds go back in. Only playback Tether paused is resumed."));
+ g_signal_connect(g_devices.cmb_airpods_pause, "changed", G_CALLBACK(on_airpods_pause_changed), nullptr);
+ gtk_box_pack_start(GTK_BOX(pause_row), g_devices.cmb_airpods_pause, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(airpods_box), pause_row, FALSE, FALSE, 0);
+
gtk_stack_add_named(GTK_STACK(g_devices.right_pane_stack), airpods_box, "airpods");
// Bluetooth
diff --git a/test/test_airpods.cpp b/test/test_airpods.cpp
index cb16b35..4f0f8d4 100644
--- a/test/test_airpods.cpp
+++ b/test/test_airpods.cpp
@@ -104,6 +104,83 @@ TEST(AirPods, RejectsMalformedListeningModes) {
EXPECT_FALSE(anc_mode_from_string("ancs").has_value());
}
+namespace {
+ std::optional<EarState> ear(std::initializer_list<uint8_t> bytes) {
+ std::vector<uint8_t> v(bytes);
+ return parse_ear(v.data(), v.size());
+ }
+ constexpr EarState WORN{EarStatus::InEar, EarStatus::InEar};
+ constexpr EarState ONE_OUT{EarStatus::InEar, EarStatus::OutOfEar};
+ constexpr EarState BOTH_OUT{EarStatus::OutOfEar, EarStatus::OutOfEar};
+ constexpr EarState UNKNOWN{};
+} // namespace
+
+TEST(AirPods, ParsesEarDetection) {
+ auto worn = ear({0x04, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00});
+ ASSERT_TRUE(worn.has_value());
+ EXPECT_EQ(worn->primary, EarStatus::InEar);
+ EXPECT_EQ(worn->secondary, EarStatus::InEar);
+ EXPECT_EQ(worn->in_ear(), 2);
+
+ auto mixed = ear({0x04, 0x00, 0x04, 0x00, 0x06, 0x00, 0x01, 0x02});
+ ASSERT_TRUE(mixed.has_value());
+ EXPECT_EQ(mixed->primary, EarStatus::OutOfEar);
+ EXPECT_EQ(mixed->secondary, EarStatus::InCase);
+ EXPECT_EQ(mixed->in_ear(), 0);
+ EXPECT_TRUE(mixed->known());
+
+ // An unrecognised status byte is unknown, not in-ear.
+ auto odd = ear({0x04, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x7f});
+ ASSERT_TRUE(odd.has_value());
+ EXPECT_EQ(odd->secondary, EarStatus::Unknown);
+ EXPECT_EQ(odd->in_ear(), 1);
+}
+
+TEST(AirPods, RejectsMalformedEarDetection) {
+ // Right prefix, wrong length.
+ EXPECT_FALSE(ear({0x04, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00}).has_value());
+ EXPECT_FALSE(ear({0x04, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00}).has_value());
+ // A battery notification is 12 bytes, but check the prefix is what rejects it.
+ EXPECT_FALSE(ear({0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x02}).has_value());
+ EXPECT_FALSE(parse_ear(nullptr, 0).has_value());
+}
+
+TEST(AirPods, PauseModeNeverDoesNothing) {
+ EXPECT_EQ(ear_media_action(WORN, BOTH_OUT, PauseMode::Never, false), MediaAction::None);
+ EXPECT_EQ(ear_media_action(BOTH_OUT, WORN, PauseMode::Never, true), MediaAction::None);
+}
+
+// The first report after connecting says where the buds already are. Reading it
+// as a transition would pause music the moment a case is opened nearby.
+TEST(AirPods, FirstEarReportIsNotATransition) {
+ EXPECT_EQ(ear_media_action(UNKNOWN, BOTH_OUT, PauseMode::OneRemoved, false), MediaAction::None);
+ EXPECT_EQ(ear_media_action(UNKNOWN, WORN, PauseMode::OneRemoved, true), MediaAction::None);
+ EXPECT_EQ(ear_media_action(WORN, UNKNOWN, PauseMode::OneRemoved, false), MediaAction::None);
+}
+
+TEST(AirPods, PausesWhenOneBudComesOut) {
+ EXPECT_EQ(ear_media_action(WORN, ONE_OUT, PauseMode::OneRemoved, false), MediaAction::Pause);
+ EXPECT_EQ(ear_media_action(ONE_OUT, WORN, PauseMode::OneRemoved, true), MediaAction::Resume);
+
+ // Both-removed is the looser policy: one bud out is still "worn".
+ EXPECT_EQ(ear_media_action(WORN, ONE_OUT, PauseMode::BothRemoved, false), MediaAction::None);
+ EXPECT_EQ(ear_media_action(ONE_OUT, BOTH_OUT, PauseMode::BothRemoved, false), MediaAction::Pause);
+ EXPECT_EQ(ear_media_action(BOTH_OUT, ONE_OUT, PauseMode::BothRemoved, true), MediaAction::Resume);
+}
+
+// Only a pause this code made is undone. Music the user stopped by hand stays stopped.
+TEST(AirPods, DoesNotResumeWhatItDidNotPause) {
+ EXPECT_EQ(ear_media_action(BOTH_OUT, WORN, PauseMode::OneRemoved, false), MediaAction::None);
+ EXPECT_EQ(ear_media_action(BOTH_OUT, WORN, PauseMode::OneRemoved, true), MediaAction::Resume);
+}
+
+TEST(AirPods, PutsABudInTheCaseTheSameAsOutOfTheEar) {
+ const EarState in_case{EarStatus::InEar, EarStatus::InCase};
+ EXPECT_EQ(ear_media_action(WORN, in_case, PauseMode::OneRemoved, false), MediaAction::Pause);
+ // An unchanged state is never a trigger, however it is reported.
+ EXPECT_EQ(ear_media_action(in_case, in_case, PauseMode::OneRemoved, false), MediaAction::None);
+}
+
TEST(AirPods, DistinguishesAirPodsFromAnIPhone) {
Device buds;
buds.name = "ZBZ AirPros";