Linux + iPhone Continuity / iMessage / SMS
feat: session lock on phone out-of-range
Zack Bartel9f451869a27a
diff --git a/docs/BLUETOOTH.md b/docs/BLUETOOTH.mdindex bc3d6b4..bdc64aa 100644--- a/docs/BLUETOOTH.md+++ b/docs/BLUETOOTH.md@@ -659,6 +659,8 @@ These are properties of what iOS exposes:- ANCS supports positive/negative notification actions only. There is no free-text reply over ANCS, replies go through MAP.- No attachments, reactions, typing indicators, or read receipts.- MAP gives no conversation identifier and no participant list for group messages, so group support is a guess and is conservative by default.+- No RSSI for a connected device, so proximity is a yes/no, never a distance. See the 2026-09-08 entry below.+- A phone that switches Bluetooth off, goes into airplane mode or runs out of battery reports `Reason.Remote`, which is indistinguishable from the user doing it deliberately. Locking on away therefore does not cover it.## Troubleshooting@@ -2848,3 +2850,70 @@ its tests pass both before and after this change. They exerciseuntestable without a phone, is *when* the registry is told a session began -- andthat was the whole defect. A test that calls `begin_session()` directly can nevercatch a `begin_session()` that is never called.++### 2026-09-08 - Out-of-range locking, and why RSSI is not how you find range++Issue #153 asked for the session to lock when the phone leaves, with an RSSI+threshold as the trigger. RSSI is not available to this daemon, measured against+BlueZ 5.87 with the phone bonded and connected:++```+$ busctl --system get-property org.bluez /org/bluez/hci0/dev_60_57_C8_30_6A_F7 \+ org.bluez.Device1 RSSI+Failed to get property RSSI on interface org.bluez.Device1: No such property 'RSSI'+```++`Device1.RSSI` is *declared* in the interface's introspection, which makes it look+available; it is only ever set from discovery reports, and never for a device that+is connected. It is absent from `GetManagedObjects` for all three devices on this+machine, including the connected iPhone, and stays absent through eight seconds of+active discovery. The kernel does hold the number, and it is out of reach:++```+$ btmgmt --index 0 conn-info 60:57:C8:30:6A:F7+Get Conn Info failed, status 0x14 (Permission Denied)+```++mgmt `Get Conn Info` wants `CAP_NET_ADMIN`. Reading connected RSSI at all means a+privileged helper, for a number that would still only be a proxy for the question.++BlueZ answers the question outright instead. `Disconnected(name, message)` carries+the kernel's mgmt disconnect reason, on `org.bluez.Device1` and, with the+experimental bearer API up, on `org.bluez.Bearer.LE1` and `Bearer.BREDR1` -- all+three on the same device object path:++| Reason | Kernel event | What it means here |+|---|---|---|+| `org.bluez.Reason.Timeout` | `MGMT_DEV_DISCONN_TIMEOUT` | link supervision timeout: the phone left |+| `org.bluez.Reason.Local` | `MGMT_DEV_DISCONN_LOCAL_HOST` | we hung up: `disconnect_classic`, adapter powered off, rfkill |+| `org.bluez.Reason.Remote` | `MGMT_DEV_DISCONN_REMOTE` | the phone hung up: Bluetooth off, airplane mode, battery |+| `org.bluez.Reason.Suspend` | `MGMT_DEV_DISCONN_LOCAL_HOST_SUSPEND` | this machine is going to sleep |+| `org.bluez.Reason.Authentication`, `Unknown` | | auth failure, controller catch-all |++Only `Timeout` locks. That the other reasons exist is what makes the feature small:+`Local` already covers the HFP bearer cycle this daemon performs on itself+(`HFP_ABSENT_SECONDS`, once per daemon life) and the radio being switched off, and+`Suspend` already covers sleep -- so there is no "we initiated this" latch to keep+and no `PrepareForSleep` hook to add. Both were in the first design and both came+back out.++`Device1.Disconnected` is a plain `GDBUS_SIGNAL`, not experimental-gated, so it is+there in compatibility mode too. One subscription with a null interface filter and+member `Disconnected` catches all three interfaces, and the handler reads which one+fired from its `interface_name` argument. This is the first thing in `monitor.cpp`+that reads a signal's payload rather than treating it as a "something moved" ping.++Locking waits for every path to be down -- BR/EDR, LE, and any open OBEX session --+and then for `lock_away_seconds` (30 by default). A bearer that times out while the+other carries on is a flap, which is the same thing `ANCS_BEARER_GRACE_SECONDS`+exists for. Coming back inside the window clears the arm and forgets the reason, so+a returning phone is never judged on why its previous link ended.++The lock itself is `org.freedesktop.login1.Session.Lock` on+`/org/freedesktop/login1/session/auto`, on the *system* bus, which resolves to the+daemon's own session with no session id to look up. `LockedHint` is read first so an+already-locked session is left alone. logind only emits a signal, so a compositor+with no lock handler configured -- hypridle, swayidle -- will do nothing with it;+`lock_command` in `bluetooth.json` runs a command instead for those setups. No+Wayland protocol is involved: implementing `ext-session-lock-v1` would mean shipping+a screen locker, which is not this daemon's job.diff --git a/po/cs.po b/po/cs.poindex e353085..389dd64 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 17:21-0700\n"+"POT-Creation-Date: 2026-09-08 22:55-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Czech\n"@@ -107,6 +107,10 @@ msgstr ""msgid "Hand the AirPods to the iPhone during a call: on or off."msgstr "Předat AirPods iPhonu během hovoru: on nebo off."+#: src/cli/main.cpp+msgid "Lock the session when the iPhone goes out of range: on or off."+msgstr "Zamknout relaci, když iPhone opustí dosah: on nebo off."+#: src/cli/main.cppmsgid "List iPhone message conversations."msgstr "Vypsat konverzace zpráv z iPhonu."@@ -505,13 +509,22 @@ msgid "Use on or off.\n"msgstr "Použijte on nebo off.\n"#: src/cli/main.cpp-msgid "An iPhone call will hand the AirPods to the phone and take them back after."+msgid ""+"An iPhone call will hand the AirPods to the phone and take them back after."msgstr "Hovor na iPhonu předá AirPods telefonu a po skončení je vrátí zpět."#: src/cli/main.cppmsgid "AirPods handoff is off."msgstr "Předávání AirPods je vypnuto."+#: src/cli/main.cpp+msgid "The session will lock when the iPhone goes out of range."+msgstr "Relace se zamkne, když iPhone opustí dosah."++#: src/cli/main.cpp+msgid "Locking on the iPhone going out of range is off."+msgstr "Zamykání při opuštění dosahu iPhonem je vypnuté."+#: src/cli/main.cppmsgid "Daemon closed the connection before the operation finished.\n"msgstr "Démon uzavřel spojení dříve, než operace skončila.\n"@@ -1873,8 +1886,14 @@ msgid "Hand the AirPods to the iPhone during a call"msgstr "Předat AirPods iPhonu během hovoru"#: src/gtk/devices_view.cpp-msgid "Pauses playback and disconnects the AirPods so the iPhone can take them, then reconnects them when the call ends. Needs call control, and only applies while the buds are connected to this computer."-msgstr "Pozastaví přehrávání a odpojí AirPods, aby si je mohl převzít iPhone, a po skončení hovoru je znovu připojí. Vyžaduje ovládání hovorů a platí jen, když jsou sluchátka připojena k tomuto počítači."+msgid ""+"Pauses playback and disconnects the AirPods so the iPhone can take them, "+"then reconnects them when the call ends. Needs call control, and only "+"applies while the buds are connected to this computer."+msgstr ""+"Pozastaví přehrávání a odpojí AirPods, aby si je mohl převzít iPhone, a po "+"skončení hovoru je znovu připojí. Vyžaduje ovládání hovorů a platí jen, když "+"jsou sluchátka připojena k tomuto počítači."#: src/gtk/devices_view.cppmsgid "Bluetooth needs one-time system setup"@@ -2141,6 +2160,24 @@ msgstr "Zobrazovat vyskakovací oznámení"msgid "Off silences iPhone alerts, new messages and arriving files."msgstr "Vypnuto ztlumí oznámení z iPhonu, nové zprávy i příchozí soubory."+#: src/gtk/settings_view.cpp+msgid "Security"+msgstr "Zabezpečení"++#: src/gtk/settings_view.cpp+msgid "What Tether does when the iPhone leaves."+msgstr "Co Tether udělá, když iPhone odejde."++#: src/gtk/settings_view.cpp+msgid "Lock the session when the iPhone goes out of range"+msgstr "Zamknout relaci, když iPhone opustí dosah"++#: src/gtk/settings_view.cpp+msgid ""+"Locks about half a minute after the link times out. Switching Bluetooth off "+"on the iPhone does not lock, and neither does suspending this machine."+msgstr "Zamkne asi půl minuty po vypršení spojení. Vypnutí Bluetooth na iPhonu nezamkne, stejně jako uspání tohoto počítače."+#: src/gtk/settings_view.cppmsgid "SMS and iMessage conversations synced over Bluetooth."msgstr "SMS a konverzace iMessage synchronizované přes Bluetooth."diff --git a/po/de.po b/po/de.poindex 8b5522c..5c356b9 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 17:21-0700\n"+"POT-Creation-Date: 2026-09-08 22:55-0700\n""PO-Revision-Date: 2026-08-22\n""Last-Translator: Tether project\n""Language-Team: German\n"@@ -107,6 +107,10 @@ msgstr ""msgid "Hand the AirPods to the iPhone during a call: on or off."msgstr "AirPods während eines Anrufs an das iPhone übergeben: on oder off."+#: src/cli/main.cpp+msgid "Lock the session when the iPhone goes out of range: on or off."+msgstr "Die Sitzung sperren, wenn das iPhone außer Reichweite gerät: on oder off."+#: src/cli/main.cppmsgid "List iPhone message conversations."msgstr "Nachrichtenunterhaltungen des iPhones auflisten."@@ -503,13 +507,24 @@ msgid "Use on or off.\n"msgstr "Verwenden Sie on oder off.\n"#: src/cli/main.cpp-msgid "An iPhone call will hand the AirPods to the phone and take them back after."-msgstr "Ein iPhone-Anruf übergibt die AirPods an das Telefon und holt sie danach zurück."+msgid ""+"An iPhone call will hand the AirPods to the phone and take them back after."+msgstr ""+"Ein iPhone-Anruf übergibt die AirPods an das Telefon und holt sie danach "+"zurück."#: src/cli/main.cppmsgid "AirPods handoff is off."msgstr "Die AirPods-Übergabe ist aus."+#: src/cli/main.cpp+msgid "The session will lock when the iPhone goes out of range."+msgstr "Die Sitzung wird gesperrt, wenn das iPhone außer Reichweite gerät."++#: src/cli/main.cpp+msgid "Locking on the iPhone going out of range is off."+msgstr "Sperren, wenn das iPhone außer Reichweite gerät, ist ausgeschaltet."+#: src/cli/main.cppmsgid "Daemon closed the connection before the operation finished.\n"msgstr ""@@ -1909,8 +1924,15 @@ msgid "Hand the AirPods to the iPhone during a call"msgstr "AirPods während eines Anrufs an das iPhone übergeben"#: src/gtk/devices_view.cpp-msgid "Pauses playback and disconnects the AirPods so the iPhone can take them, then reconnects them when the call ends. Needs call control, and only applies while the buds are connected to this computer."-msgstr "Pausiert die Wiedergabe und trennt die AirPods, damit das iPhone sie übernehmen kann, und verbindet sie nach dem Anruf wieder. Erfordert Anrufsteuerung und gilt nur, solange die Hörer mit diesem Computer verbunden sind."+msgid ""+"Pauses playback and disconnects the AirPods so the iPhone can take them, "+"then reconnects them when the call ends. Needs call control, and only "+"applies while the buds are connected to this computer."+msgstr ""+"Pausiert die Wiedergabe und trennt die AirPods, damit das iPhone sie "+"übernehmen kann, und verbindet sie nach dem Anruf wieder. Erfordert "+"Anrufsteuerung und gilt nur, solange die Hörer mit diesem Computer verbunden "+"sind."#: src/gtk/devices_view.cppmsgid "Bluetooth needs one-time system setup"@@ -2184,6 +2206,24 @@ msgid "Off silences iPhone alerts, new messages and arriving files."msgstr """Aus schaltet iPhone-Hinweise, neue Nachrichten und ankommende Dateien stumm."+#: src/gtk/settings_view.cpp+msgid "Security"+msgstr "Sicherheit"++#: src/gtk/settings_view.cpp+msgid "What Tether does when the iPhone leaves."+msgstr "Was Tether tut, wenn das iPhone geht."++#: src/gtk/settings_view.cpp+msgid "Lock the session when the iPhone goes out of range"+msgstr "Sitzung sperren, wenn das iPhone außer Reichweite gerät"++#: src/gtk/settings_view.cpp+msgid ""+"Locks about half a minute after the link times out. Switching Bluetooth off "+"on the iPhone does not lock, and neither does suspending this machine."+msgstr "Sperrt etwa eine halbe Minute nachdem die Verbindung abgelaufen ist. Bluetooth am iPhone auszuschalten sperrt nicht, und diese Maschine in den Ruhezustand zu versetzen ebenso wenig."+#: src/gtk/settings_view.cppmsgid "SMS and iMessage conversations synced over Bluetooth."msgstr ""diff --git a/po/es.po b/po/es.poindex b3a044b..3023df1 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 17:21-0700\n"+"POT-Creation-Date: 2026-09-08 22:55-0700\n""PO-Revision-Date: 2026-08-22\n""Last-Translator: Tether project\n""Language-Team: Spanish\n"@@ -110,6 +110,10 @@ msgstr ""msgid "Hand the AirPods to the iPhone during a call: on or off."msgstr "Pasar los AirPods al iPhone durante una llamada: on u off."+#: src/cli/main.cpp+msgid "Lock the session when the iPhone goes out of range: on or off."+msgstr "Bloquear la sesión cuando el iPhone quede fuera de alcance: on u off."+#: src/cli/main.cppmsgid "List iPhone message conversations."msgstr "Listar las conversaciones de mensajes del iPhone."@@ -507,13 +511,24 @@ msgid "Use on or off.\n"msgstr "Use on u off.\n"#: src/cli/main.cpp-msgid "An iPhone call will hand the AirPods to the phone and take them back after."-msgstr "Una llamada en el iPhone pasará los AirPods al teléfono y los recuperará al terminar."+msgid ""+"An iPhone call will hand the AirPods to the phone and take them back after."+msgstr ""+"Una llamada en el iPhone pasará los AirPods al teléfono y los recuperará al "+"terminar."#: src/cli/main.cppmsgid "AirPods handoff is off."msgstr "El traspaso de los AirPods está desactivado."+#: src/cli/main.cpp+msgid "The session will lock when the iPhone goes out of range."+msgstr "La sesión se bloqueará cuando el iPhone quede fuera de alcance."++#: src/cli/main.cpp+msgid "Locking on the iPhone going out of range is off."+msgstr "El bloqueo cuando el iPhone queda fuera de alcance está desactivado."+#: src/cli/main.cppmsgid "Daemon closed the connection before the operation finished.\n"msgstr "El daemon cerró la conexión antes de terminar la operación.\n"@@ -1901,8 +1916,15 @@ msgid "Hand the AirPods to the iPhone during a call"msgstr "Pasar los AirPods al iPhone durante una llamada"#: src/gtk/devices_view.cpp-msgid "Pauses playback and disconnects the AirPods so the iPhone can take them, then reconnects them when the call ends. Needs call control, and only applies while the buds are connected to this computer."-msgstr "Pausa la reproducción y desconecta los AirPods para que el iPhone pueda tomarlos, y los vuelve a conectar cuando termina la llamada. Requiere control de llamadas y solo se aplica mientras los auriculares están conectados a este equipo."+msgid ""+"Pauses playback and disconnects the AirPods so the iPhone can take them, "+"then reconnects them when the call ends. Needs call control, and only "+"applies while the buds are connected to this computer."+msgstr ""+"Pausa la reproducción y desconecta los AirPods para que el iPhone pueda "+"tomarlos, y los vuelve a conectar cuando termina la llamada. Requiere "+"control de llamadas y solo se aplica mientras los auriculares están "+"conectados a este equipo."#: src/gtk/devices_view.cppmsgid "Bluetooth needs one-time system setup"@@ -2173,6 +2195,24 @@ msgstr """Desactivado silencia los avisos del iPhone, los mensajes nuevos y los ""archivos que llegan."+#: src/gtk/settings_view.cpp+msgid "Security"+msgstr "Seguridad"++#: src/gtk/settings_view.cpp+msgid "What Tether does when the iPhone leaves."+msgstr "Qué hace Tether cuando el iPhone se va."++#: src/gtk/settings_view.cpp+msgid "Lock the session when the iPhone goes out of range"+msgstr "Bloquear la sesión cuando el iPhone quede fuera de alcance"++#: src/gtk/settings_view.cpp+msgid ""+"Locks about half a minute after the link times out. Switching Bluetooth off "+"on the iPhone does not lock, and neither does suspending this machine."+msgstr "Bloquea alrededor de medio minuto después de que el enlace expire. Apagar el Bluetooth en el iPhone no bloquea, y suspender esta máquina tampoco."+#: src/gtk/settings_view.cppmsgid "SMS and iMessage conversations synced over Bluetooth."msgstr "Conversaciones de SMS e iMessage sincronizadas por Bluetooth."diff --git a/po/fr.po b/po/fr.poindex 3e1e2ec..86f2e2e 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 17:21-0700\n"+"POT-Creation-Date: 2026-09-08 22:55-0700\n""PO-Revision-Date: 2026-08-22\n""Last-Translator: Tether project\n""Language-Team: French\n"@@ -110,6 +110,10 @@ msgstr ""msgid "Hand the AirPods to the iPhone during a call: on or off."msgstr "Confier les AirPods à l'iPhone pendant un appel : on ou off."+#: src/cli/main.cpp+msgid "Lock the session when the iPhone goes out of range: on or off."+msgstr "Verrouiller la session quand l'iPhone sort de portée : on ou off."+#: src/cli/main.cppmsgid "List iPhone message conversations."msgstr "Lister les conversations de l'iPhone."@@ -510,13 +514,23 @@ msgid "Use on or off.\n"msgstr "Utilisez on ou off.\n"#: src/cli/main.cpp-msgid "An iPhone call will hand the AirPods to the phone and take them back after."-msgstr "Un appel sur l'iPhone lui confiera les AirPods et les récupérera ensuite."+msgid ""+"An iPhone call will hand the AirPods to the phone and take them back after."+msgstr ""+"Un appel sur l'iPhone lui confiera les AirPods et les récupérera ensuite."#: src/cli/main.cppmsgid "AirPods handoff is off."msgstr "Le transfert des AirPods est désactivé."+#: src/cli/main.cpp+msgid "The session will lock when the iPhone goes out of range."+msgstr "La session se verrouillera quand l'iPhone sortira de portée."++#: src/cli/main.cpp+msgid "Locking on the iPhone going out of range is off."+msgstr "Le verrouillage quand l'iPhone sort de portée est désactivé."+#: src/cli/main.cppmsgid "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"@@ -1908,8 +1922,15 @@ msgid "Hand the AirPods to the iPhone during a call"msgstr "Confier les AirPods à l'iPhone pendant un appel"#: src/gtk/devices_view.cpp-msgid "Pauses playback and disconnects the AirPods so the iPhone can take them, then reconnects them when the call ends. Needs call control, and only applies while the buds are connected to this computer."-msgstr "Met la lecture en pause et déconnecte les AirPods pour que l'iPhone puisse les prendre, puis les reconnecte à la fin de l'appel. Nécessite la gestion des appels et ne s'applique que tant que les écouteurs sont connectés à cet ordinateur."+msgid ""+"Pauses playback and disconnects the AirPods so the iPhone can take them, "+"then reconnects them when the call ends. Needs call control, and only "+"applies while the buds are connected to this computer."+msgstr ""+"Met la lecture en pause et déconnecte les AirPods pour que l'iPhone puisse "+"les prendre, puis les reconnecte à la fin de l'appel. Nécessite la gestion "+"des appels et ne s'applique que tant que les écouteurs sont connectés à cet "+"ordinateur."#: src/gtk/devices_view.cppmsgid "Bluetooth needs one-time system setup"@@ -2181,6 +2202,24 @@ msgstr """Désactivé, cela coupe les alertes de l'iPhone, les nouveaux messages et les ""fichiers reçus."+#: src/gtk/settings_view.cpp+msgid "Security"+msgstr "Sécurité"++#: src/gtk/settings_view.cpp+msgid "What Tether does when the iPhone leaves."+msgstr "Ce que fait Tether quand l'iPhone s'en va."++#: src/gtk/settings_view.cpp+msgid "Lock the session when the iPhone goes out of range"+msgstr "Verrouiller la session quand l'iPhone sort de portée"++#: src/gtk/settings_view.cpp+msgid ""+"Locks about half a minute after the link times out. Switching Bluetooth off "+"on the iPhone does not lock, and neither does suspending this machine."+msgstr "Verrouille environ une demi-minute après l'expiration du lien. Couper le Bluetooth sur l'iPhone ne verrouille pas, et mettre cette machine en veille non plus."+#: src/gtk/settings_view.cppmsgid "SMS and iMessage conversations synced over Bluetooth."msgstr "Conversations SMS et iMessage synchronisées par Bluetooth."diff --git a/po/it.po b/po/it.poindex 0067f87..066db4a 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 17:21-0700\n"+"POT-Creation-Date: 2026-09-08 22:55-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Italian\n"@@ -111,6 +111,10 @@ msgstr ""msgid "Hand the AirPods to the iPhone during a call: on or off."msgstr "Passa gli AirPods all'iPhone durante una chiamata: on oppure off."+#: src/cli/main.cpp+msgid "Lock the session when the iPhone goes out of range: on or off."+msgstr "Blocca la sessione quando l'iPhone esce dalla portata: on oppure off."+#: src/cli/main.cppmsgid "List iPhone message conversations."msgstr "Elenca le conversazioni di messaggi dell'iPhone."@@ -507,13 +511,23 @@ msgid "Use on or off.\n"msgstr "Usa on oppure off.\n"#: src/cli/main.cpp-msgid "An iPhone call will hand the AirPods to the phone and take them back after."-msgstr "Una chiamata sull'iPhone gli passerà gli AirPods e li riprenderà al termine."+msgid ""+"An iPhone call will hand the AirPods to the phone and take them back after."+msgstr ""+"Una chiamata sull'iPhone gli passerà gli AirPods e li riprenderà al termine."#: src/cli/main.cppmsgid "AirPods handoff is off."msgstr "Il passaggio degli AirPods è disattivato."+#: src/cli/main.cpp+msgid "The session will lock when the iPhone goes out of range."+msgstr "La sessione verrà bloccata quando l'iPhone esce dalla portata."++#: src/cli/main.cpp+msgid "Locking on the iPhone going out of range is off."+msgstr "Il blocco quando l'iPhone esce dalla portata è disattivato."+#: src/cli/main.cppmsgid "Daemon closed the connection before the operation finished.\n"msgstr "Il daemon ha chiuso la connessione prima che l'operazione finisse.\n"@@ -1901,8 +1915,15 @@ msgid "Hand the AirPods to the iPhone during a call"msgstr "Passa gli AirPods all'iPhone durante una chiamata"#: src/gtk/devices_view.cpp-msgid "Pauses playback and disconnects the AirPods so the iPhone can take them, then reconnects them when the call ends. Needs call control, and only applies while the buds are connected to this computer."-msgstr "Mette in pausa la riproduzione e disconnette gli AirPods perché l'iPhone possa prenderli, poi li riconnette al termine della chiamata. Richiede il controllo delle chiamate e si applica solo mentre gli auricolari sono connessi a questo computer."+msgid ""+"Pauses playback and disconnects the AirPods so the iPhone can take them, "+"then reconnects them when the call ends. Needs call control, and only "+"applies while the buds are connected to this computer."+msgstr ""+"Mette in pausa la riproduzione e disconnette gli AirPods perché l'iPhone "+"possa prenderli, poi li riconnette al termine della chiamata. Richiede il "+"controllo delle chiamate e si applica solo mentre gli auricolari sono "+"connessi a questo computer."#: src/gtk/devices_view.cppmsgid "Bluetooth needs one-time system setup"@@ -2174,6 +2195,24 @@ msgstr """Disattivato silenzia gli avvisi dell'iPhone, i nuovi messaggi e i file in ""arrivo."+#: src/gtk/settings_view.cpp+msgid "Security"+msgstr "Sicurezza"++#: src/gtk/settings_view.cpp+msgid "What Tether does when the iPhone leaves."+msgstr "Cosa fa Tether quando l'iPhone se ne va."++#: src/gtk/settings_view.cpp+msgid "Lock the session when the iPhone goes out of range"+msgstr "Blocca la sessione quando l'iPhone esce dalla portata"++#: src/gtk/settings_view.cpp+msgid ""+"Locks about half a minute after the link times out. Switching Bluetooth off "+"on the iPhone does not lock, and neither does suspending this machine."+msgstr "Blocca circa mezzo minuto dopo la scadenza del collegamento. Disattivare il Bluetooth sull'iPhone non blocca, e nemmeno sospendere questa macchina."+#: src/gtk/settings_view.cppmsgid "SMS and iMessage conversations synced over Bluetooth."msgstr "Conversazioni SMS e iMessage sincronizzate via Bluetooth."diff --git a/po/ja.po b/po/ja.poindex fa207a1..d2591dc 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 17:21-0700\n"+"POT-Creation-Date: 2026-09-08 22:55-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Japanese\n"@@ -108,6 +108,10 @@ msgstr ""msgid "Hand the AirPods to the iPhone during a call: on or off."msgstr "通話中に AirPods を iPhone へ渡します: on または off。"+#: src/cli/main.cpp+msgid "Lock the session when the iPhone goes out of range: on or off."+msgstr "iPhone が範囲外になったらセッションをロックします: on または off。"+#: src/cli/main.cppmsgid "List iPhone message conversations."msgstr "iPhone のメッセージの会話を一覧表示します。"@@ -496,13 +500,22 @@ msgid "Use on or off.\n"msgstr "on または off を指定してください。\n"#: src/cli/main.cpp-msgid "An iPhone call will hand the AirPods to the phone and take them back after."+msgid ""+"An iPhone call will hand the AirPods to the phone and take them back after."msgstr "iPhone の通話で AirPods を iPhone に渡し、終了後に戻します。"#: src/cli/main.cppmsgid "AirPods handoff is off."msgstr "AirPods の受け渡しはオフです。"+#: src/cli/main.cpp+msgid "The session will lock when the iPhone goes out of range."+msgstr "iPhone が範囲外になるとセッションをロックします。"++#: src/cli/main.cpp+msgid "Locking on the iPhone going out of range is off."+msgstr "iPhone が範囲外になったときのロックは無効です。"+#: src/cli/main.cppmsgid "Daemon closed the connection before the operation finished.\n"msgstr "操作が完了する前にデーモンが接続を閉じました。\n"@@ -1866,8 +1879,14 @@ msgid "Hand the AirPods to the iPhone during a call"msgstr "通話中に AirPods を iPhone へ渡す"#: src/gtk/devices_view.cpp-msgid "Pauses playback and disconnects the AirPods so the iPhone can take them, then reconnects them when the call ends. Needs call control, and only applies while the buds are connected to this computer."-msgstr "再生を一時停止して AirPods を切断し、iPhone が使えるようにします。通話が終わると再接続します。通話制御が必要で、イヤホンがこのコンピュータに接続されている間だけ適用されます。"+msgid ""+"Pauses playback and disconnects the AirPods so the iPhone can take them, "+"then reconnects them when the call ends. Needs call control, and only "+"applies while the buds are connected to this computer."+msgstr ""+"再生を一時停止して AirPods を切断し、iPhone が使えるようにします。通話が終わ"+"ると再接続します。通話制御が必要で、イヤホンがこのコンピュータに接続されてい"+"る間だけ適用されます。"#: src/gtk/devices_view.cppmsgid "Bluetooth needs one-time system setup"@@ -2137,6 +2156,24 @@ msgstr """オフにすると iPhone の通知、新着メッセージ、受信ファイルがすべて表示されませ""ん。"+#: src/gtk/settings_view.cpp+msgid "Security"+msgstr "セキュリティ"++#: src/gtk/settings_view.cpp+msgid "What Tether does when the iPhone leaves."+msgstr "iPhone が離れたときに Tether が行うこと。"++#: src/gtk/settings_view.cpp+msgid "Lock the session when the iPhone goes out of range"+msgstr "iPhone が範囲外になったらセッションをロックする"++#: src/gtk/settings_view.cpp+msgid ""+"Locks about half a minute after the link times out. Switching Bluetooth off "+"on the iPhone does not lock, and neither does suspending this machine."+msgstr "リンクがタイムアウトしてから約 30 秒後にロックします。iPhone 側で Bluetooth を切ってもロックせず、このマシンをサスペンドしてもロックしません。"+#: src/gtk/settings_view.cppmsgid "SMS and iMessage conversations synced over Bluetooth."msgstr "Bluetooth 経由で同期される SMS と iMessage の会話です。"diff --git a/po/ko.po b/po/ko.poindex fdbcf27..983e6e4 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 17:21-0700\n"+"POT-Creation-Date: 2026-09-08 22:55-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Korean\n"@@ -106,6 +106,10 @@ msgstr ""msgid "Hand the AirPods to the iPhone during a call: on or off."msgstr "통화 중에 AirPods를 iPhone에 넘깁니다: on 또는 off."+#: src/cli/main.cpp+msgid "Lock the session when the iPhone goes out of range: on or off."+msgstr "iPhone이 범위를 벗어나면 세션을 잠급니다: on 또는 off."+#: src/cli/main.cppmsgid "List iPhone message conversations."msgstr "iPhone의 메시지 대화를 나열합니다."@@ -493,13 +497,23 @@ msgid "Use on or off.\n"msgstr "on 또는 off를 사용하세요.\n"#: src/cli/main.cpp-msgid "An iPhone call will hand the AirPods to the phone and take them back after."-msgstr "iPhone 통화 시 AirPods를 전화기에 넘기고 통화가 끝나면 다시 가져옵니다."+msgid ""+"An iPhone call will hand the AirPods to the phone and take them back after."+msgstr ""+"iPhone 통화 시 AirPods를 전화기에 넘기고 통화가 끝나면 다시 가져옵니다."#: src/cli/main.cppmsgid "AirPods handoff is off."msgstr "AirPods 전환이 꺼져 있습니다."+#: src/cli/main.cpp+msgid "The session will lock when the iPhone goes out of range."+msgstr "iPhone이 범위를 벗어나면 세션을 잠급니다."++#: src/cli/main.cpp+msgid "Locking on the iPhone going out of range is off."+msgstr "iPhone이 범위를 벗어날 때 잠그는 기능이 꺼져 있습니다."+#: src/cli/main.cppmsgid "Daemon closed the connection before the operation finished.\n"msgstr "작업이 끝나기 전에 데몬이 연결을 닫았습니다.\n"@@ -1844,8 +1858,14 @@ msgid "Hand the AirPods to the iPhone during a call"msgstr "통화 중에 AirPods를 iPhone에 넘기기"#: src/gtk/devices_view.cpp-msgid "Pauses playback and disconnects the AirPods so the iPhone can take them, then reconnects them when the call ends. Needs call control, and only applies while the buds are connected to this computer."-msgstr "재생을 일시정지하고 AirPods 연결을 끊어 iPhone이 사용할 수 있게 한 뒤, 통화가 끝나면 다시 연결합니다. 통화 제어가 필요하며 이어버드가 이 컴퓨터에 연결되어 있을 때만 적용됩니다."+msgid ""+"Pauses playback and disconnects the AirPods so the iPhone can take them, "+"then reconnects them when the call ends. Needs call control, and only "+"applies while the buds are connected to this computer."+msgstr ""+"재생을 일시정지하고 AirPods 연결을 끊어 iPhone이 사용할 수 있게 한 뒤, 통화"+"가 끝나면 다시 연결합니다. 통화 제어가 필요하며 이어버드가 이 컴퓨터에 연결되"+"어 있을 때만 적용됩니다."#: src/gtk/devices_view.cppmsgid "Bluetooth needs one-time system setup"@@ -2109,6 +2129,24 @@ msgstr "데스크톱 팝업 표시"msgid "Off silences iPhone alerts, new messages and arriving files."msgstr "끄면 iPhone 알림, 새 메시지, 도착한 파일이 모두 표시되지 않습니다."+#: src/gtk/settings_view.cpp+msgid "Security"+msgstr "보안"++#: src/gtk/settings_view.cpp+msgid "What Tether does when the iPhone leaves."+msgstr "iPhone이 멀어질 때 Tether가 하는 일."++#: src/gtk/settings_view.cpp+msgid "Lock the session when the iPhone goes out of range"+msgstr "iPhone이 범위를 벗어나면 세션 잠그기"++#: src/gtk/settings_view.cpp+msgid ""+"Locks about half a minute after the link times out. Switching Bluetooth off "+"on the iPhone does not lock, and neither does suspending this machine."+msgstr "링크가 시간 초과된 뒤 약 30초 후에 잠급니다. iPhone에서 Bluetooth를 꺼도 잠기지 않으며, 이 기기를 절전 모드로 두어도 잠기지 않습니다."+#: src/gtk/settings_view.cppmsgid "SMS and iMessage conversations synced over Bluetooth."msgstr "Bluetooth로 동기화되는 SMS 및 iMessage 대화입니다."diff --git a/po/nl.po b/po/nl.poindex 441077d..2a063c7 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 17:21-0700\n"+"POT-Creation-Date: 2026-09-08 22:55-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Dutch\n"@@ -108,6 +108,10 @@ msgstr ""msgid "Hand the AirPods to the iPhone during a call: on or off."msgstr "De AirPods tijdens een gesprek aan de iPhone geven: on of off."+#: src/cli/main.cpp+msgid "Lock the session when the iPhone goes out of range: on or off."+msgstr "De sessie vergrendelen wanneer de iPhone buiten bereik raakt: on of off."+#: src/cli/main.cppmsgid "List iPhone message conversations."msgstr "Berichtgesprekken van de iPhone tonen."@@ -504,13 +508,24 @@ msgid "Use on or off.\n"msgstr "Gebruik on of off.\n"#: src/cli/main.cpp-msgid "An iPhone call will hand the AirPods to the phone and take them back after."-msgstr "Een gesprek op de iPhone geeft de AirPods aan de telefoon en haalt ze daarna terug."+msgid ""+"An iPhone call will hand the AirPods to the phone and take them back after."+msgstr ""+"Een gesprek op de iPhone geeft de AirPods aan de telefoon en haalt ze daarna "+"terug."#: src/cli/main.cppmsgid "AirPods handoff is off."msgstr "AirPods-overdracht staat uit."+#: src/cli/main.cpp+msgid "The session will lock when the iPhone goes out of range."+msgstr "De sessie wordt vergrendeld wanneer de iPhone buiten bereik raakt."++#: src/cli/main.cpp+msgid "Locking on the iPhone going out of range is off."+msgstr "Vergrendelen wanneer de iPhone buiten bereik raakt staat uit."+#: src/cli/main.cppmsgid "Daemon closed the connection before the operation finished.\n"msgstr "De daemon sloot de verbinding voordat de bewerking klaar was.\n"@@ -1888,8 +1903,15 @@ msgid "Hand the AirPods to the iPhone during a call"msgstr "De AirPods tijdens een gesprek aan de iPhone geven"#: src/gtk/devices_view.cpp-msgid "Pauses playback and disconnects the AirPods so the iPhone can take them, then reconnects them when the call ends. Needs call control, and only applies while the buds are connected to this computer."-msgstr "Pauzeert de weergave en verbreekt de verbinding met de AirPods zodat de iPhone ze kan overnemen, en verbindt ze na het gesprek weer. Vereist gespreksbediening en geldt alleen zolang de oordopjes met deze computer verbonden zijn."+msgid ""+"Pauses playback and disconnects the AirPods so the iPhone can take them, "+"then reconnects them when the call ends. Needs call control, and only "+"applies while the buds are connected to this computer."+msgstr ""+"Pauzeert de weergave en verbreekt de verbinding met de AirPods zodat de "+"iPhone ze kan overnemen, en verbindt ze na het gesprek weer. Vereist "+"gespreksbediening en geldt alleen zolang de oordopjes met deze computer "+"verbonden zijn."#: src/gtk/devices_view.cppmsgid "Bluetooth needs one-time system setup"@@ -2157,6 +2179,24 @@ msgid "Off silences iPhone alerts, new messages and arriving files."msgstr """Uit dempt iPhone-meldingen, nieuwe berichten en binnenkomende bestanden."+#: src/gtk/settings_view.cpp+msgid "Security"+msgstr "Beveiliging"++#: src/gtk/settings_view.cpp+msgid "What Tether does when the iPhone leaves."+msgstr "Wat Tether doet wanneer de iPhone weggaat."++#: src/gtk/settings_view.cpp+msgid "Lock the session when the iPhone goes out of range"+msgstr "De sessie vergrendelen wanneer de iPhone buiten bereik raakt"++#: src/gtk/settings_view.cpp+msgid ""+"Locks about half a minute after the link times out. Switching Bluetooth off "+"on the iPhone does not lock, and neither does suspending this machine."+msgstr "Vergrendelt ongeveer een halve minuut nadat de verbinding verlopen is. Bluetooth uitzetten op de iPhone vergrendelt niet, en deze machine in slaapstand zetten evenmin."+#: src/gtk/settings_view.cppmsgid "SMS and iMessage conversations synced over Bluetooth."msgstr "Sms- en iMessage-gesprekken die via Bluetooth worden gesynchroniseerd."diff --git a/po/pl.po b/po/pl.poindex 58aec1b..0ffc146 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 17:21-0700\n"+"POT-Creation-Date: 2026-09-08 22:55-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Polish\n"@@ -108,6 +108,10 @@ msgstr ""msgid "Hand the AirPods to the iPhone during a call: on or off."msgstr "Przekaż AirPods do iPhone’a na czas rozmowy: on lub off."+#: src/cli/main.cpp+msgid "Lock the session when the iPhone goes out of range: on or off."+msgstr "Zablokuj sesję, gdy iPhone znajdzie się poza zasięgiem: on lub off."+#: src/cli/main.cppmsgid "List iPhone message conversations."msgstr "Wypisz rozmowy z wiadomościami z iPhone'a."@@ -508,13 +512,24 @@ msgid "Use on or off.\n"msgstr "Użyj on lub off.\n"#: src/cli/main.cpp-msgid "An iPhone call will hand the AirPods to the phone and take them back after."-msgstr "Rozmowa na iPhonie przekaże mu AirPods, a po jej zakończeniu odbierze je z powrotem."+msgid ""+"An iPhone call will hand the AirPods to the phone and take them back after."+msgstr ""+"Rozmowa na iPhonie przekaże mu AirPods, a po jej zakończeniu odbierze je z "+"powrotem."#: src/cli/main.cppmsgid "AirPods handoff is off."msgstr "Przekazywanie AirPods jest wyłączone."+#: src/cli/main.cpp+msgid "The session will lock when the iPhone goes out of range."+msgstr "Sesja zostanie zablokowana, gdy iPhone znajdzie się poza zasięgiem."++#: src/cli/main.cpp+msgid "Locking on the iPhone going out of range is off."+msgstr "Blokowanie, gdy iPhone znajdzie się poza zasięgiem, jest wyłączone."+#: src/cli/main.cppmsgid "Daemon closed the connection before the operation finished.\n"msgstr "Demon zamknął połączenie, zanim operacja się zakończyła.\n"@@ -1889,8 +1904,14 @@ msgid "Hand the AirPods to the iPhone during a call"msgstr "Przekaż AirPods do iPhone’a na czas rozmowy"#: src/gtk/devices_view.cpp-msgid "Pauses playback and disconnects the AirPods so the iPhone can take them, then reconnects them when the call ends. Needs call control, and only applies while the buds are connected to this computer."-msgstr "Wstrzymuje odtwarzanie i rozłącza AirPods, aby iPhone mógł je przejąć, a po zakończeniu rozmowy łączy je ponownie. Wymaga obsługi połączeń i działa tylko wtedy, gdy słuchawki są połączone z tym komputerem."+msgid ""+"Pauses playback and disconnects the AirPods so the iPhone can take them, "+"then reconnects them when the call ends. Needs call control, and only "+"applies while the buds are connected to this computer."+msgstr ""+"Wstrzymuje odtwarzanie i rozłącza AirPods, aby iPhone mógł je przejąć, a po "+"zakończeniu rozmowy łączy je ponownie. Wymaga obsługi połączeń i działa "+"tylko wtedy, gdy słuchawki są połączone z tym komputerem."#: src/gtk/devices_view.cppmsgid "Bluetooth needs one-time system setup"@@ -2160,6 +2181,24 @@ msgid "Off silences iPhone alerts, new messages and arriving files."msgstr """Wyłączenie wycisza alerty z iPhone'a, nowe wiadomości i przychodzące pliki."+#: src/gtk/settings_view.cpp+msgid "Security"+msgstr "Bezpieczeństwo"++#: src/gtk/settings_view.cpp+msgid "What Tether does when the iPhone leaves."+msgstr "Co Tether robi, gdy iPhone odchodzi."++#: src/gtk/settings_view.cpp+msgid "Lock the session when the iPhone goes out of range"+msgstr "Zablokuj sesję, gdy iPhone znajdzie się poza zasięgiem"++#: src/gtk/settings_view.cpp+msgid ""+"Locks about half a minute after the link times out. Switching Bluetooth off "+"on the iPhone does not lock, and neither does suspending this machine."+msgstr "Blokuje około pół minuty po wygaśnięciu połączenia. Wyłączenie Bluetootha w iPhonie nie blokuje, podobnie jak uśpienie tego komputera."+#: src/gtk/settings_view.cppmsgid "SMS and iMessage conversations synced over Bluetooth."msgstr "Rozmowy SMS i iMessage synchronizowane przez Bluetooth."diff --git a/po/pt_BR.po b/po/pt_BR.poindex d1ada57..4928935 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 17:21-0700\n"+"POT-Creation-Date: 2026-09-08 22:55-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Brazilian Portuguese\n"@@ -109,6 +109,10 @@ msgstr ""msgid "Hand the AirPods to the iPhone during a call: on or off."msgstr "Passar os AirPods para o iPhone durante uma chamada: on ou off."+#: src/cli/main.cpp+msgid "Lock the session when the iPhone goes out of range: on or off."+msgstr "Bloquear a sessão quando o iPhone sair do alcance: on ou off."+#: src/cli/main.cppmsgid "List iPhone message conversations."msgstr "Listar as conversas de mensagens do iPhone."@@ -504,13 +508,24 @@ msgid "Use on or off.\n"msgstr "Use on ou off.\n"#: src/cli/main.cpp-msgid "An iPhone call will hand the AirPods to the phone and take them back after."-msgstr "Uma chamada no iPhone passará os AirPods para o telefone e os trará de volta depois."+msgid ""+"An iPhone call will hand the AirPods to the phone and take them back after."+msgstr ""+"Uma chamada no iPhone passará os AirPods para o telefone e os trará de volta "+"depois."#: src/cli/main.cppmsgid "AirPods handoff is off."msgstr "A transferência dos AirPods está desativada."+#: src/cli/main.cpp+msgid "The session will lock when the iPhone goes out of range."+msgstr "A sessão será bloqueada quando o iPhone sair do alcance."++#: src/cli/main.cpp+msgid "Locking on the iPhone going out of range is off."+msgstr "O bloqueio quando o iPhone sai do alcance está desativado."+#: src/cli/main.cppmsgid "Daemon closed the connection before the operation finished.\n"msgstr "O daemon fechou a conexão antes de a operação terminar.\n"@@ -1891,8 +1906,14 @@ msgid "Hand the AirPods to the iPhone during a call"msgstr "Passar os AirPods para o iPhone durante uma chamada"#: src/gtk/devices_view.cpp-msgid "Pauses playback and disconnects the AirPods so the iPhone can take them, then reconnects them when the call ends. Needs call control, and only applies while the buds are connected to this computer."-msgstr "Pausa a reprodução e desconecta os AirPods para que o iPhone possa assumi-los, e os reconecta quando a chamada termina. Requer controle de chamadas e só se aplica enquanto os fones estiverem conectados a este computador."+msgid ""+"Pauses playback and disconnects the AirPods so the iPhone can take them, "+"then reconnects them when the call ends. Needs call control, and only "+"applies while the buds are connected to this computer."+msgstr ""+"Pausa a reprodução e desconecta os AirPods para que o iPhone possa assumi-"+"los, e os reconecta quando a chamada termina. Requer controle de chamadas e "+"só se aplica enquanto os fones estiverem conectados a este computador."#: src/gtk/devices_view.cppmsgid "Bluetooth needs one-time system setup"@@ -2161,6 +2182,24 @@ msgid "Off silences iPhone alerts, new messages and arriving files."msgstr """Desligado silencia alertas do iPhone, mensagens novas e arquivos que chegam."+#: src/gtk/settings_view.cpp+msgid "Security"+msgstr "Segurança"++#: src/gtk/settings_view.cpp+msgid "What Tether does when the iPhone leaves."+msgstr "O que o Tether faz quando o iPhone vai embora."++#: src/gtk/settings_view.cpp+msgid "Lock the session when the iPhone goes out of range"+msgstr "Bloquear a sessão quando o iPhone sair do alcance"++#: src/gtk/settings_view.cpp+msgid ""+"Locks about half a minute after the link times out. Switching Bluetooth off "+"on the iPhone does not lock, and neither does suspending this machine."+msgstr "Bloqueia cerca de meio minuto após o enlace expirar. Desligar o Bluetooth no iPhone não bloqueia, e suspender esta máquina também não."+#: src/gtk/settings_view.cppmsgid "SMS and iMessage conversations synced over Bluetooth."msgstr "Conversas de SMS e iMessage sincronizadas por Bluetooth."diff --git a/po/ru.po b/po/ru.poindex eeeda7a..f2f2b96 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 17:21-0700\n"+"POT-Creation-Date: 2026-09-08 22:55-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Russian\n"@@ -108,6 +108,10 @@ msgstr ""msgid "Hand the AirPods to the iPhone during a call: on or off."msgstr "Передавать AirPods на iPhone во время звонка: on или off."+#: src/cli/main.cpp+msgid "Lock the session when the iPhone goes out of range: on or off."+msgstr "Блокировать сеанс, когда iPhone выходит из зоны действия: on или off."+#: src/cli/main.cppmsgid "List iPhone message conversations."msgstr "Показать переписки с сообщениями на iPhone."@@ -508,13 +512,24 @@ msgid "Use on or off.\n"msgstr "Используйте on или off.\n"#: src/cli/main.cpp-msgid "An iPhone call will hand the AirPods to the phone and take them back after."-msgstr "Звонок на iPhone передаст AirPods телефону и вернёт их обратно после завершения."+msgid ""+"An iPhone call will hand the AirPods to the phone and take them back after."+msgstr ""+"Звонок на iPhone передаст AirPods телефону и вернёт их обратно после "+"завершения."#: src/cli/main.cppmsgid "AirPods handoff is off."msgstr "Передача AirPods выключена."+#: src/cli/main.cpp+msgid "The session will lock when the iPhone goes out of range."+msgstr "Сеанс будет заблокирован, когда iPhone выйдет из зоны действия."++#: src/cli/main.cpp+msgid "Locking on the iPhone going out of range is off."+msgstr "Блокировка при выходе iPhone из зоны действия выключена."+#: src/cli/main.cppmsgid "Daemon closed the connection before the operation finished.\n"msgstr "Демон закрыл соединение до завершения операции.\n"@@ -1890,8 +1905,14 @@ msgid "Hand the AirPods to the iPhone during a call"msgstr "Передавать AirPods на iPhone во время звонка"#: src/gtk/devices_view.cpp-msgid "Pauses playback and disconnects the AirPods so the iPhone can take them, then reconnects them when the call ends. Needs call control, and only applies while the buds are connected to this computer."-msgstr "Ставит воспроизведение на паузу и отключает AirPods, чтобы их мог забрать iPhone, а после звонка подключает их обратно. Требуется управление звонками; действует, только пока наушники подключены к этому компьютеру."+msgid ""+"Pauses playback and disconnects the AirPods so the iPhone can take them, "+"then reconnects them when the call ends. Needs call control, and only "+"applies while the buds are connected to this computer."+msgstr ""+"Ставит воспроизведение на паузу и отключает AirPods, чтобы их мог забрать "+"iPhone, а после звонка подключает их обратно. Требуется управление звонками; "+"действует, только пока наушники подключены к этому компьютеру."#: src/gtk/devices_view.cppmsgid "Bluetooth needs one-time system setup"@@ -2160,6 +2181,24 @@ msgstr """Выключено — не показываются оповещения iPhone, новые сообщения и полученные ""файлы."+#: src/gtk/settings_view.cpp+msgid "Security"+msgstr "Безопасность"++#: src/gtk/settings_view.cpp+msgid "What Tether does when the iPhone leaves."+msgstr "Что Tether делает, когда iPhone уходит."++#: src/gtk/settings_view.cpp+msgid "Lock the session when the iPhone goes out of range"+msgstr "Блокировать сеанс, когда iPhone выходит из зоны действия"++#: src/gtk/settings_view.cpp+msgid ""+"Locks about half a minute after the link times out. Switching Bluetooth off "+"on the iPhone does not lock, and neither does suspending this machine."+msgstr "Блокирует примерно через полминуты после истечения времени соединения. Выключение Bluetooth на iPhone не блокирует, как и переход этой машины в спящий режим."+#: src/gtk/settings_view.cppmsgid "SMS and iMessage conversations synced over Bluetooth."msgstr "Переписка SMS и iMessage, синхронизируемая по Bluetooth."diff --git a/po/sv.po b/po/sv.poindex d0bbf67..b95812a 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 17:21-0700\n"+"POT-Creation-Date: 2026-09-08 22:55-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Swedish\n"@@ -108,6 +108,10 @@ msgstr ""msgid "Hand the AirPods to the iPhone during a call: on or off."msgstr "Lämna över AirPods till iPhone under ett samtal: on eller off."+#: src/cli/main.cpp+msgid "Lock the session when the iPhone goes out of range: on or off."+msgstr "Lås sessionen när iPhonen hamnar utom räckhåll: on eller off."+#: src/cli/main.cppmsgid "List iPhone message conversations."msgstr "Lista iPhonens meddelandekonversationer."@@ -501,13 +505,24 @@ msgid "Use on or off.\n"msgstr "Använd on eller off.\n"#: src/cli/main.cpp-msgid "An iPhone call will hand the AirPods to the phone and take them back after."-msgstr "Ett samtal på iPhone lämnar över AirPods till telefonen och tar tillbaka dem efteråt."+msgid ""+"An iPhone call will hand the AirPods to the phone and take them back after."+msgstr ""+"Ett samtal på iPhone lämnar över AirPods till telefonen och tar tillbaka dem "+"efteråt."#: src/cli/main.cppmsgid "AirPods handoff is off."msgstr "Överlämning av AirPods är av."+#: src/cli/main.cpp+msgid "The session will lock when the iPhone goes out of range."+msgstr "Sessionen låses när iPhonen hamnar utom räckhåll."++#: src/cli/main.cpp+msgid "Locking on the iPhone going out of range is off."+msgstr "Låsning när iPhonen hamnar utom räckhåll är avstängd."+#: src/cli/main.cppmsgid "Daemon closed the connection before the operation finished.\n"msgstr "Demonen stängde anslutningen innan åtgärden var klar.\n"@@ -1870,8 +1885,14 @@ msgid "Hand the AirPods to the iPhone during a call"msgstr "Lämna över AirPods till iPhone under ett samtal"#: src/gtk/devices_view.cpp-msgid "Pauses playback and disconnects the AirPods so the iPhone can take them, then reconnects them when the call ends. Needs call control, and only applies while the buds are connected to this computer."-msgstr "Pausar uppspelningen och kopplar från AirPods så att iPhone kan ta över dem, och ansluter dem igen när samtalet är slut. Kräver samtalsstyrning och gäller bara medan propparna är anslutna till den här datorn."+msgid ""+"Pauses playback and disconnects the AirPods so the iPhone can take them, "+"then reconnects them when the call ends. Needs call control, and only "+"applies while the buds are connected to this computer."+msgstr ""+"Pausar uppspelningen och kopplar från AirPods så att iPhone kan ta över dem, "+"och ansluter dem igen när samtalet är slut. Kräver samtalsstyrning och "+"gäller bara medan propparna är anslutna till den här datorn."#: src/gtk/devices_view.cppmsgid "Bluetooth needs one-time system setup"@@ -2140,6 +2161,24 @@ msgstr "Visa skrivbordsnotiser"msgid "Off silences iPhone alerts, new messages and arriving files."msgstr "Av tystar iPhone-aviseringar, nya meddelanden och inkommande filer."+#: src/gtk/settings_view.cpp+msgid "Security"+msgstr "Säkerhet"++#: src/gtk/settings_view.cpp+msgid "What Tether does when the iPhone leaves."+msgstr "Vad Tether gör när iPhonen försvinner."++#: src/gtk/settings_view.cpp+msgid "Lock the session when the iPhone goes out of range"+msgstr "Lås sessionen när iPhonen hamnar utom räckhåll"++#: src/gtk/settings_view.cpp+msgid ""+"Locks about half a minute after the link times out. Switching Bluetooth off "+"on the iPhone does not lock, and neither does suspending this machine."+msgstr "Låser ungefär en halv minut efter att länken gått ut. Att stänga av Bluetooth på iPhonen låser inte, och inte heller att försätta den här maskinen i vila."+#: src/gtk/settings_view.cppmsgid "SMS and iMessage conversations synced over Bluetooth."msgstr "SMS- och iMessage-konversationer som synkas via Bluetooth."diff --git a/po/tether.pot b/po/tether.potindex 6a11d62..43d5820 100644--- a/po/tether.pot+++ b/po/tether.pot@@ -6,9 +6,9 @@#, fuzzymsgid ""msgstr ""-"Project-Id-Version: tether 0.2.27\n"+"Project-Id-Version: tether 0.2.28\n""Report-Msgid-Bugs-To: [email protected]\n"-"POT-Creation-Date: 2026-09-08 17:21-0700\n"+"POT-Creation-Date: 2026-09-08 22:55-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"@@ -104,6 +104,10 @@ msgstr ""msgid "Hand the AirPods to the iPhone during a call: on or off."msgstr ""+#: src/cli/main.cpp+msgid "Lock the session when the iPhone goes out of range: on or off."+msgstr ""+#: src/cli/main.cppmsgid "List iPhone message conversations."msgstr ""@@ -468,6 +472,14 @@ msgstr ""msgid "AirPods handoff is off."msgstr ""+#: src/cli/main.cpp+msgid "The session will lock when the iPhone goes out of range."+msgstr ""++#: src/cli/main.cpp+msgid "Locking on the iPhone going out of range is off."+msgstr ""+#: src/cli/main.cppmsgid "Daemon closed the connection before the operation finished.\n"msgstr ""@@ -1969,6 +1981,24 @@ msgstr ""msgid "Off silences iPhone alerts, new messages and arriving files."msgstr ""+#: src/gtk/settings_view.cpp+msgid "Security"+msgstr ""++#: src/gtk/settings_view.cpp+msgid "What Tether does when the iPhone leaves."+msgstr ""++#: src/gtk/settings_view.cpp+msgid "Lock the session when the iPhone goes out of range"+msgstr ""++#: src/gtk/settings_view.cpp+msgid ""+"Locks about half a minute after the link times out. Switching Bluetooth off "+"on the iPhone does not lock, and neither does suspending this machine."+msgstr ""+#: src/gtk/settings_view.cppmsgid "SMS and iMessage conversations synced over Bluetooth."msgstr ""diff --git a/po/tr.po b/po/tr.poindex dadabf5..1414a69 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 17:21-0700\n"+"POT-Creation-Date: 2026-09-08 22:55-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Turkish\n"@@ -106,6 +106,10 @@ msgstr ""msgid "Hand the AirPods to the iPhone during a call: on or off."msgstr "Görüşme sırasında AirPods’u iPhone’a devret: on veya off."+#: src/cli/main.cpp+msgid "Lock the session when the iPhone goes out of range: on or off."+msgstr "iPhone menzil dışına çıkınca oturumu kilitle: on veya off."+#: src/cli/main.cppmsgid "List iPhone message conversations."msgstr "iPhone'daki mesaj konuşmalarını listele."@@ -502,13 +506,24 @@ msgid "Use on or off.\n"msgstr "on veya off kullanın.\n"#: src/cli/main.cpp-msgid "An iPhone call will hand the AirPods to the phone and take them back after."-msgstr "iPhone’daki bir çağrı AirPods’u telefona devreder ve görüşme bitince geri alır."+msgid ""+"An iPhone call will hand the AirPods to the phone and take them back after."+msgstr ""+"iPhone’daki bir çağrı AirPods’u telefona devreder ve görüşme bitince geri "+"alır."#: src/cli/main.cppmsgid "AirPods handoff is off."msgstr "AirPods devri kapalı."+#: src/cli/main.cpp+msgid "The session will lock when the iPhone goes out of range."+msgstr "iPhone menzil dışına çıkınca oturum kilitlenecek."++#: src/cli/main.cpp+msgid "Locking on the iPhone going out of range is off."+msgstr "iPhone menzil dışına çıkınca kilitleme kapalı."+#: src/cli/main.cppmsgid "Daemon closed the connection before the operation finished.\n"msgstr "Arka plan hizmeti, işlem bitmeden bağlantıyı kapattı.\n"@@ -1866,8 +1881,14 @@ msgid "Hand the AirPods to the iPhone during a call"msgstr "Görüşme sırasında AirPods’u iPhone’a devret"#: src/gtk/devices_view.cpp-msgid "Pauses playback and disconnects the AirPods so the iPhone can take them, then reconnects them when the call ends. Needs call control, and only applies while the buds are connected to this computer."-msgstr "Oynatmayı duraklatır ve iPhone alabilsin diye AirPods bağlantısını keser, görüşme bitince yeniden bağlar. Çağrı denetimi gerektirir ve yalnızca kulaklıklar bu bilgisayara bağlıyken geçerlidir."+msgid ""+"Pauses playback and disconnects the AirPods so the iPhone can take them, "+"then reconnects them when the call ends. Needs call control, and only "+"applies while the buds are connected to this computer."+msgstr ""+"Oynatmayı duraklatır ve iPhone alabilsin diye AirPods bağlantısını keser, "+"görüşme bitince yeniden bağlar. Çağrı denetimi gerektirir ve yalnızca "+"kulaklıklar bu bilgisayara bağlıyken geçerlidir."#: src/gtk/devices_view.cppmsgid "Bluetooth needs one-time system setup"@@ -2137,6 +2158,24 @@ msgid "Off silences iPhone alerts, new messages and arriving files."msgstr """Kapalıyken iPhone uyarıları, yeni mesajlar ve gelen dosyalar susturulur."+#: src/gtk/settings_view.cpp+msgid "Security"+msgstr "Güvenlik"++#: src/gtk/settings_view.cpp+msgid "What Tether does when the iPhone leaves."+msgstr "iPhone uzaklaştığında Tether'ın yaptıkları."++#: src/gtk/settings_view.cpp+msgid "Lock the session when the iPhone goes out of range"+msgstr "iPhone menzil dışına çıkınca oturumu kilitle"++#: src/gtk/settings_view.cpp+msgid ""+"Locks about half a minute after the link times out. Switching Bluetooth off "+"on the iPhone does not lock, and neither does suspending this machine."+msgstr "Bağlantı zaman aşımına uğradıktan yaklaşık yarım dakika sonra kilitler. iPhone'da Bluetooth'u kapatmak kilitlemez, bu makineyi uyku moduna almak da kilitlemez."+#: src/gtk/settings_view.cppmsgid "SMS and iMessage conversations synced over Bluetooth."msgstr "Bluetooth üzerinden eşitlenen SMS ve iMessage konuşmaları."diff --git a/po/uk.po b/po/uk.poindex 9699c46..188bdf1 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 17:21-0700\n"+"POT-Creation-Date: 2026-09-08 22:55-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Ukrainian\n"@@ -110,6 +110,10 @@ msgstr ""msgid "Hand the AirPods to the iPhone during a call: on or off."msgstr "Передавати AirPods на iPhone під час дзвінка: on або off."+#: src/cli/main.cpp+msgid "Lock the session when the iPhone goes out of range: on or off."+msgstr "Блокувати сеанс, коли iPhone виходить із зони дії: on або off."+#: src/cli/main.cppmsgid "List iPhone message conversations."msgstr "Показати розмови з повідомленнями на iPhone."@@ -509,13 +513,23 @@ msgid "Use on or off.\n"msgstr "Використовуйте on або off.\n"#: src/cli/main.cpp-msgid "An iPhone call will hand the AirPods to the phone and take them back after."-msgstr "Дзвінок на iPhone передасть йому AirPods і поверне їх після завершення."+msgid ""+"An iPhone call will hand the AirPods to the phone and take them back after."+msgstr ""+"Дзвінок на iPhone передасть йому AirPods і поверне їх після завершення."#: src/cli/main.cppmsgid "AirPods handoff is off."msgstr "Передавання AirPods вимкнено."+#: src/cli/main.cpp+msgid "The session will lock when the iPhone goes out of range."+msgstr "Сеанс буде заблоковано, коли iPhone вийде із зони дії."++#: src/cli/main.cpp+msgid "Locking on the iPhone going out of range is off."+msgstr "Блокування, коли iPhone виходить із зони дії, вимкнено."+#: src/cli/main.cppmsgid "Daemon closed the connection before the operation finished.\n"msgstr "Демон закрив з'єднання до завершення операції.\n"@@ -1888,8 +1902,14 @@ msgid "Hand the AirPods to the iPhone during a call"msgstr "Передавати AirPods на iPhone під час дзвінка"#: src/gtk/devices_view.cpp-msgid "Pauses playback and disconnects the AirPods so the iPhone can take them, then reconnects them when the call ends. Needs call control, and only applies while the buds are connected to this computer."-msgstr "Ставить відтворення на паузу й від’єднує AirPods, щоб їх міг забрати iPhone, а після дзвінка під’єднує знову. Потрібне керування дзвінками; діє, лише поки навушники під’єднані до цього комп’ютера."+msgid ""+"Pauses playback and disconnects the AirPods so the iPhone can take them, "+"then reconnects them when the call ends. Needs call control, and only "+"applies while the buds are connected to this computer."+msgstr ""+"Ставить відтворення на паузу й від’єднує AirPods, щоб їх міг забрати iPhone, "+"а після дзвінка під’єднує знову. Потрібне керування дзвінками; діє, лише "+"поки навушники під’єднані до цього комп’ютера."#: src/gtk/devices_view.cppmsgid "Bluetooth needs one-time system setup"@@ -2159,6 +2179,24 @@ msgstr """Вимкнено — не показуються сповіщення з iPhone, нові повідомлення та отримані ""файли."+#: src/gtk/settings_view.cpp+msgid "Security"+msgstr "Безпека"++#: src/gtk/settings_view.cpp+msgid "What Tether does when the iPhone leaves."+msgstr "Що Tether робить, коли iPhone іде."++#: src/gtk/settings_view.cpp+msgid "Lock the session when the iPhone goes out of range"+msgstr "Блокувати сеанс, коли iPhone виходить із зони дії"++#: src/gtk/settings_view.cpp+msgid ""+"Locks about half a minute after the link times out. Switching Bluetooth off "+"on the iPhone does not lock, and neither does suspending this machine."+msgstr "Блокує приблизно за півхвилини після того, як з'єднання завершиться за часом. Вимкнення Bluetooth на iPhone не блокує, як і присипляння цієї машини."+#: src/gtk/settings_view.cppmsgid "SMS and iMessage conversations synced over Bluetooth."msgstr "Розмови SMS та iMessage, синхронізовані через Bluetooth."diff --git a/po/zh_CN.po b/po/zh_CN.poindex bf67f2f..5ea7a04 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 17:21-0700\n"+"POT-Creation-Date: 2026-09-08 22:55-0700\n""PO-Revision-Date: 2026-08-23\n""Last-Translator: Tether project\n""Language-Team: Simplified Chinese\n"@@ -104,6 +104,10 @@ msgstr "取下 AirPod 时暂停本机播放:never、one-removed、both-removedmsgid "Hand the AirPods to the iPhone during a call: on or off."msgstr "通话期间将 AirPods 交给 iPhone:on 或 off。"+#: src/cli/main.cpp+msgid "Lock the session when the iPhone goes out of range: on or off."+msgstr "当 iPhone 超出范围时锁定会话:on 或 off。"+#: src/cli/main.cppmsgid "List iPhone message conversations."msgstr "列出 iPhone 的信息会话。"@@ -483,13 +487,22 @@ msgid "Use on or off.\n"msgstr "请使用 on 或 off。\n"#: src/cli/main.cpp-msgid "An iPhone call will hand the AirPods to the phone and take them back after."+msgid ""+"An iPhone call will hand the AirPods to the phone and take them back after."msgstr "iPhone 来电时会将 AirPods 交给手机,通话结束后再取回。"#: src/cli/main.cppmsgid "AirPods handoff is off."msgstr "AirPods 交接已关闭。"+#: src/cli/main.cpp+msgid "The session will lock when the iPhone goes out of range."+msgstr "当 iPhone 超出范围时将锁定会话。"++#: src/cli/main.cpp+msgid "Locking on the iPhone going out of range is off."+msgstr "iPhone 超出范围时锁定已关闭。"+#: src/cli/main.cppmsgid "Daemon closed the connection before the operation finished.\n"msgstr "操作完成前守护进程已关闭连接。\n"@@ -1804,8 +1817,13 @@ msgid "Hand the AirPods to the iPhone during a call"msgstr "通话期间将 AirPods 交给 iPhone"#: src/gtk/devices_view.cpp-msgid "Pauses playback and disconnects the AirPods so the iPhone can take them, then reconnects them when the call ends. Needs call control, and only applies while the buds are connected to this computer."-msgstr "暂停播放并断开 AirPods,让 iPhone 可以接管,通话结束后再重新连接。需要通话控制,且仅在耳机连接到本机时生效。"+msgid ""+"Pauses playback and disconnects the AirPods so the iPhone can take them, "+"then reconnects them when the call ends. Needs call control, and only "+"applies while the buds are connected to this computer."+msgstr ""+"暂停播放并断开 AirPods,让 iPhone 可以接管,通话结束后再重新连接。需要通话控"+"制,且仅在耳机连接到本机时生效。"#: src/gtk/devices_view.cppmsgid "Bluetooth needs one-time system setup"@@ -2066,6 +2084,24 @@ msgstr "显示桌面弹窗"msgid "Off silences iPhone alerts, new messages and arriving files."msgstr "关闭后将不显示 iPhone 提醒、新消息和收到的文件。"+#: src/gtk/settings_view.cpp+msgid "Security"+msgstr "安全"++#: src/gtk/settings_view.cpp+msgid "What Tether does when the iPhone leaves."+msgstr "iPhone 离开时 Tether 的行为。"++#: src/gtk/settings_view.cpp+msgid "Lock the session when the iPhone goes out of range"+msgstr "当 iPhone 超出范围时锁定会话"++#: src/gtk/settings_view.cpp+msgid ""+"Locks about half a minute after the link times out. Switching Bluetooth off "+"on the iPhone does not lock, and neither does suspending this machine."+msgstr "在链路超时约半分钟后锁定。在 iPhone 上关闭蓝牙不会锁定,将本机挂起也不会。"+#: src/gtk/settings_view.cppmsgid "SMS and iMessage conversations synced over Bluetooth."msgstr "通过蓝牙同步的短信和 iMessage 会话。"diff --git a/src/cli/main.cpp b/src/cli/main.cppindex 4d684b2..edec726 100644--- a/src/cli/main.cpp+++ b/src/cli/main.cpp@@ -195,6 +195,7 @@ static const Opt kOptions[] = {{"--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-airpods-handoff", N_("Hand the AirPods to the iPhone during a call: on or off.")},+ {"--bt-lock-on-away", N_("Lock the session when the iPhone goes out of range: on or off.")},{"--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.")},@@ -595,6 +596,22 @@ static int set_bt_airpods_handoff(tether::Client& client, const std::string& valreturn 0;}+static int set_bt_lock_on_away(tether::Client& client, const std::string& value) {+ if (value != "on" && value != "off") {+ debug::log(ERR, _("Use on or off.\n"));+ return 1;+ }+ if (!client.send(nlohmann::json{{"command", "bt_set_lock_on_away"}, {"enabled", value == "on"}}.dump() + "\n")) {+ debug::log(ERR, _("Could not reach the daemon.\n"));+ return 1;+ }+ fprintf(stdout,+ "%s\n",+ value == "on" ? _("The session will lock when the iPhone goes out of range.")+ : _("Locking on the iPhone going out of range is off."));+ 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,@@ -1056,6 +1073,10 @@ int main(int argc, char* argv[]) {action = "bt_airpods_handoff";if (i + 1 < argc && argv[i + 1][0] != '-')arg_val = argv[++i];+ } else if (arg == "--bt-lock-on-away") {+ action = "bt_lock_on_away";+ 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") {@@ -1299,6 +1320,8 @@ int main(int argc, char* argv[]) {return set_bt_airpods_pause(client, arg_val);} else if (action == "bt_airpods_handoff") {return set_bt_airpods_handoff(client, arg_val);+ } else if (action == "bt_lock_on_away") {+ return set_bt_lock_on_away(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.txtindex f2bf324..9283010 100644--- a/src/core/CMakeLists.txt+++ b/src/core/CMakeLists.txt@@ -39,6 +39,7 @@ add_library(tether STATICsrc/bluetooth/airpods.cppsrc/bluetooth/connection.cppsrc/bluetooth/diagnostics.cpp+ src/session_lock.cppsrc/wayland.cppsrc/wayland_protocols/wayland.cppsrc/wayland_protocols/wlr-data-control-unstable-v1.cppdiff --git a/src/core/include/tether/bluetooth/bearer_supervisor.hpp b/src/core/include/tether/bluetooth/bearer_supervisor.hppindex e264a8a..8c2ab4d 100644--- a/src/core/include/tether/bluetooth/bearer_supervisor.hpp+++ b/src/core/include/tether/bluetooth/bearer_supervisor.hpp@@ -36,6 +36,13 @@ namespace tether::bluetooth {// GATT discovery on a freshly opened link, which runs to about a minute.inline constexpr int ANCS_ABSENT_GRACE_SECONDS = 75;+ // How long every bearer must stay down, after a link supervision timeout,+ // before the phone counts as gone rather than flapping.+ inline constexpr int AWAY_LOCK_GRACE_SECONDS = 30;++ // org.bluez Disconnected reasons.+ inline constexpr const char* REASON_TIMEOUT = "org.bluez.Reason.Timeout";+// What BlueZ did with a request to bring a bearer up. Accepting a request is// not a link: only an observed Connected is that.enum class ConnectResult {@@ -101,6 +108,24 @@ namespace tether::bluetooth {return ancs_enabled && bearer.le_available && !bearer.le_dialling && (!bearer.le_connected || link_dead);}+ // Whether the phone has been gone long enough, and for the right reason, to+ // lock the session.+ inline bool should_lock_on_away(bool enabled,+ const BearerStatus& bearer,+ bool obex_up,+ const std::string& reason,+ int64_t now,+ int64_t gone_since,+ int grace_seconds) {+ if (!enabled || gone_since < 0 || obex_up)+ return false;+ if (!bearer.device_paired || bearer.classic_connected || bearer.le_connected)+ return false;+ if (reason != REASON_TIMEOUT)+ return false;+ return now - gone_since >= grace_seconds;+ }+// Keeps the Classic and LE halves of one bond connected.//// Order is important: BR/EDR first, a settling interval, then LEdiff --git a/src/core/include/tether/bluetooth/config.hpp b/src/core/include/tether/bluetooth/config.hppindex b1d1fb9..5303ed2 100644--- a/src/core/include/tether/bluetooth/config.hpp+++ b/src/core/include/tether/bluetooth/config.hpp@@ -1,5 +1,6 @@#pragma once+#include "tether/bluetooth/bearer_supervisor.hpp"#include "tether/secret_store.hpp"#include <string>@@ -52,6 +53,12 @@ namespace tether::bluetooth {PauseMode airpods_pause = PauseMode::Never;// Whether an iPhone call hands the AirPods to the phone and takes them back after.bool airpods_handoff = false;+ // Whether losing the iPhone to a link supervision timeout locks the session.+ bool lock_on_away = false;+ // How long every bearer must stay down before the session is locked.+ int lock_away_seconds = AWAY_LOCK_GRACE_SECONDS;+ // What performs the lock. Empty uses logind.+ std::string lock_command;bool operator==(const Config&) const = default;};diff --git a/src/core/include/tether/bluetooth/connection.hpp b/src/core/include/tether/bluetooth/connection.hppindex a2b521c..5ef1d76 100644--- a/src/core/include/tether/bluetooth/connection.hpp+++ b/src/core/include/tether/bluetooth/connection.hpp@@ -51,6 +51,9 @@ namespace tether::bluetooth {// which app sent them. Takes effect on the next notification.void set_ancs_content_enabled(bool enabled);+ // Whether the session locks when the phone drops out of range.+ void set_lock_on_away(bool enabled, int grace_seconds);+// Invokes a mirrored notification's action.bool perform_notification_action(uint32_t uid, ancs::ActionId action);diff --git a/src/core/include/tether/bluetooth/monitor.hpp b/src/core/include/tether/bluetooth/monitor.hppindex f39792b..1345edc 100644--- a/src/core/include/tether/bluetooth/monitor.hpp+++ b/src/core/include/tether/bluetooth/monitor.hpp@@ -36,6 +36,12 @@ namespace tether::bluetooth {BluezObjects snapshot() const;Capability capability() const;+ // Reason from the last org.bluez Disconnected signal for the device+ std::string last_disconnect_reason(const std::string& address) const;++ // Clears the last disconnect reason for the device, so that the next disconnect will be reported.+ void clear_disconnect_reason(const std::string& address);+// Which controller to use: "hciN" or an address, empty for the first powered one.void set_preferred_adapter(std::string id);std::string preferred_adapter_id() const;diff --git a/src/core/include/tether/session_lock.hpp b/src/core/include/tether/session_lock.hppnew file mode 100644index 0000000..a5078dc--- /dev/null+++ b/src/core/include/tether/session_lock.hpp@@ -0,0 +1,10 @@+#pragma once++#include <string>++namespace tether {++ // Locks the desktop session. With `command` empty this asks logind.+ bool lock_session(const std::string& command);++} // namespace tetherdiff --git a/src/core/src/bluetooth/config.cpp b/src/core/src/bluetooth/config.cppindex 0b0c53a..af4de1d 100644--- a/src/core/src/bluetooth/config.cpp+++ b/src/core/src/bluetooth/config.cpp@@ -2,6 +2,7 @@#include "tether/log.hpp"#include "tether/paths.hpp"+#include <algorithm>#include <cstdlib>#include <filesystem>#include <fstream>@@ -65,6 +66,9 @@ namespace tether::bluetooth {j["desktop_popups_enabled"] = config.desktop_popups_enabled;j["airpods_pause"] = to_string(config.airpods_pause);j["airpods_handoff"] = config.airpods_handoff;+ j["lock_on_away"] = config.lock_on_away;+ j["lock_away_seconds"] = config.lock_away_seconds;+ j["lock_command"] = config.lock_command;return j.dump(2);}@@ -87,6 +91,10 @@ namespace tether::bluetooth {config.desktop_popups_enabled = j.value("desktop_popups_enabled", true);config.airpods_pause = pause_mode_from_string(j.value("airpods_pause", ""));config.airpods_handoff = j.value("airpods_handoff", false);+ config.lock_on_away = j.value("lock_on_away", false);+ // A zero or negative grace would lock on the first flap.+ config.lock_away_seconds = std::max(1, j.value("lock_away_seconds", AWAY_LOCK_GRACE_SECONDS));+ config.lock_command = j.value("lock_command", "");} catch (const std::exception&) {// A corrupt file must not stop the daemon; defaults are safe.}diff --git a/src/core/src/bluetooth/connection.cpp b/src/core/src/bluetooth/connection.cppindex d2542b1..ecd5969 100644--- a/src/core/src/bluetooth/connection.cpp+++ b/src/core/src/bluetooth/connection.cpp@@ -10,6 +10,7 @@#include "tether/bluetooth/pbap_session.hpp"#include "tether/log.hpp"#include "tether/secret_store.hpp"+#include "tether/session_lock.hpp"#include <tether/i18n.hpp>#include <algorithm>@@ -644,6 +645,13 @@ namespace tether::bluetooth {bool ancs_enabled = true;bool link_was_ready = false;bool device_was_present = false;+ // Whether losing the phone to a supervision timeout locks the session+ std::atomic<bool> lock_on_away{false};+ std::atomic<int> lock_away_seconds{AWAY_LOCK_GRACE_SECONDS};+ // When the last path to the phone went down, -1 while any is up.+ int64_t gone_since = -1;+ // Whether the away lock has already fired for this absence.+ bool lock_fired = false;// When the LE bearer was last seen down, so a blip can be told from a// session that is really gone. -1 while it is up.int64_t le_down_since = -1;@@ -693,6 +701,10 @@ namespace tether::bluetooth {}void run();++ // Locks the session once the phone has been out of range long enough.+ void supervise_away_lock(int64_t now, bool obex_up);+void sync_messages(int64_t now);void sync_contacts();void sync_ancs(int64_t now);@@ -1180,6 +1192,36 @@ namespace tether::bluetooth {on_calls(std::move(calls));}+ void ConnectionState::supervise_away_lock(int64_t now, bool obex_up) {+ const auto& bearer = bearers->status();+ const bool reachable = bearer.classic_connected || bearer.le_connected || obex_up;++ if (reachable) {+ gone_since = -1;+ lock_fired = false;+ // A link that came back must not be judged on why the last one ended.+ if (monitor)+ monitor->clear_disconnect_reason(address);+ return;+ }++ if (gone_since < 0)+ gone_since = now;++ const bool enabled = lock_on_away.load();+ if (!enabled || lock_fired || !monitor)+ return;++ const std::string reason = monitor->last_disconnect_reason(address);+ if (!should_lock_on_away(enabled, bearer, obex_up, reason, now, gone_since, lock_away_seconds.load()))+ return;++ lock_fired = true;+ debug::log(INFO, "bluetooth: iPhone out of range for {}s, locking the session", now - gone_since);+ if (!lock_session(load_config().lock_command))+ debug::log(WARN, "bluetooth: could not lock the session");+ }+void ConnectionState::run() {using namespace std::chrono;const auto started = steady_clock::now();@@ -1215,6 +1257,8 @@ namespace tether::bluetooth {const auto& bearer = bearers->status();+ supervise_away_lock(now, obex_up);+supervise_ancs_solicitation(*monitor, should_solicit_ancs(ancs_enabled, bearer, now, ancs_absent_since));// publish() drops a payload identical to the last one, so refreshing@@ -1265,6 +1309,8 @@ namespace tether::bluetooth {const Config config = load_config();state_->ancs_content_wanted = config.ancs_content_enabled;state_->calls_wanted = config.calls_enabled;+ state_->lock_on_away = config.lock_on_away;+ state_->lock_away_seconds = config.lock_away_seconds;// Read the controller's capability here rather than letting each caller// latch its own copy. At startup BlueZ may not have finished enumerating// the adapter, and its free advertising-instance count drops to zero@@ -1391,6 +1437,11 @@ namespace tether::bluetooth {void ConnectionManager::set_calls_enabled(bool enabled) { state_->calls_wanted = enabled; }+ void ConnectionManager::set_lock_on_away(bool enabled, int grace_seconds) {+ state_->lock_on_away = enabled;+ state_->lock_away_seconds = grace_seconds;+ }+bool ConnectionManager::dial(const std::string& number, std::string& err) {auto client = state_->calls_client();if (!client) {diff --git a/src/core/src/bluetooth/monitor.cpp b/src/core/src/bluetooth/monitor.cppindex d70e2af..8991864 100644--- a/src/core/src/bluetooth/monitor.cpp+++ b/src/core/src/bluetooth/monitor.cpp@@ -12,6 +12,7 @@#include <filesystem>#include <fstream>#include <gio/gio.h>+#include <map>#include <mutex>#include <optional>#include <poll.h>@@ -48,6 +49,7 @@ namespace tether::bluetooth {mutable std::mutex mutex;BluezObjects objects;Capability cap;+ std::map<std::string, std::string> disconnect_reasons;std::string preferred_adapter_id;std::string secure_adapter;std::optional<bool> secure_connections;@@ -74,6 +76,33 @@ namespace tether::bluetooth {static_cast<MonitorState*>(user_data)->schedule_refresh();}+ void on_disconnected(GDBusConnection*,+ const gchar*,+ const gchar* object_path,+ const gchar* interface_name,+ const gchar*,+ GVariant* parameters,+ gpointer user_data) {+ const gchar* reason = nullptr;+ const gchar* message = nullptr;+ g_variant_get(parameters, "(&s&s)", &reason, &message);+ if (!reason || !object_path)+ return;++ auto* impl = static_cast<MonitorState*>(user_data);+ {+ std::lock_guard<std::mutex> lock(impl->mutex);+ impl->disconnect_reasons[object_path] = reason;+ }+ debug::log(INFO,+ "bluetooth: {} disconnected from {}: {} ({})",+ interface_name ? interface_name : "?",+ object_path,+ reason,+ message ? message : "");+ impl->schedule_refresh();+ }+// on watcher thread once it iterates its contextgboolean quit_loop(gpointer user_data) {auto* state = static_cast<MonitorState*>(user_data);@@ -349,6 +378,16 @@ namespace tether::bluetooth {on_bluez_signal,this,nullptr));+ subscriptions.push_back(g_dbus_connection_signal_subscribe(conn,+ BLUEZ_NAME,+ nullptr,+ "Disconnected",+ nullptr,+ nullptr,+ G_DBUS_SIGNAL_FLAGS_NONE,+ on_disconnected,+ this,+ nullptr));refresh();@@ -504,6 +543,25 @@ namespace tether::bluetooth {return impl_->cap;}+ std::string BluezMonitor::last_disconnect_reason(const std::string& address) const {+ std::lock_guard<std::mutex> lock(impl_->mutex);+ for (const auto& device : impl_->objects.devices) {+ if (device.address != address)+ continue;+ auto it = impl_->disconnect_reasons.find(device.path);+ return it == impl_->disconnect_reasons.end() ? std::string{} : it->second;+ }+ return {};+ }++ void BluezMonitor::clear_disconnect_reason(const std::string& address) {+ std::lock_guard<std::mutex> lock(impl_->mutex);+ for (const auto& device : impl_->objects.devices) {+ if (device.address == address)+ impl_->disconnect_reasons.erase(device.path);+ }+ }+void BluezMonitor::set_preferred_adapter(std::string id) {{std::lock_guard<std::mutex> lock(impl_->mutex);diff --git a/src/core/src/net.cpp b/src/core/src/net.cppindex ac1c9c3..e978673 100644--- a/src/core/src/net.cpp+++ b/src/core/src/net.cpp@@ -312,6 +312,8 @@ namespace tether {status["desktop_popups_enabled"] = config.desktop_popups_enabled;status["airpods_pause"] = to_string(config.airpods_pause);status["airpods_handoff"] = config.airpods_handoff;+ status["lock_on_away"] = config.lock_on_away;+ status["lock_away_seconds"] = config.lock_away_seconds;status["version"] = TETHER_VERSION;if (!bluetooth::g_bluez) {status["capability"] = nullptr;@@ -1162,6 +1164,16 @@ namespace tether {if (bluetooth::g_bt_connections)bluetooth::g_bt_connections->set_calls_enabled(config.calls_enabled);broadcast_local_event(build_bt_status().dump());+ } else if (j.contains("command") && j["command"] == "bt_set_lock_on_away") {+ auto config = bluetooth::load_config();+ config.lock_on_away = j.value("enabled", false);+ config.lock_away_seconds =+ std::max(1, j.value("grace_seconds", bluetooth::AWAY_LOCK_GRACE_SECONDS));+ bluetooth::save_config(config);+ if (bluetooth::g_bt_connections)+ bluetooth::g_bt_connections->set_lock_on_away(config.lock_on_away,+ config.lock_away_seconds);+ broadcast_local_event(build_bt_status().dump());} else if (j.contains("command") && j["command"] == "set_desktop_popups") {auto config = bluetooth::load_config();config.desktop_popups_enabled = j.value("enabled", true);diff --git a/src/core/src/session_lock.cpp b/src/core/src/session_lock.cppnew file mode 100644index 0000000..567dfe6--- /dev/null+++ b/src/core/src/session_lock.cpp@@ -0,0 +1,122 @@+#include "tether/session_lock.hpp"++#include <tether/log.hpp>++#include <gio/gio.h>++namespace tether {++ namespace {++ constexpr const char* LOGIND_NAME = "org.freedesktop.login1";+ constexpr const char* SESSION_PATH = "/org/freedesktop/login1/session/auto";+ constexpr const char* SESSION_IFACE = "org.freedesktop.login1.Session";++ constexpr int CALL_TIMEOUT_MS = 1000;++ // logind is on the system bus, unlike the session services elsewhere here.+ GDBusConnection* bus() {+ static GDBusConnection* connection = [] {+ GError* error = nullptr;+ GDBusConnection* c = g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, &error);+ if (!c) {+ debug::log(WARN, "lock: no system bus: {}", error ? error->message : "unknown");+ g_clear_error(&error);+ }+ return c;+ }();+ return connection;+ }++ bool already_locked(GDBusConnection* connection) {+ GError* error = nullptr;+ GVariant* reply = g_dbus_connection_call_sync(connection,+ LOGIND_NAME,+ SESSION_PATH,+ "org.freedesktop.DBus.Properties",+ "Get",+ g_variant_new("(ss)", SESSION_IFACE, "LockedHint"),+ G_VARIANT_TYPE("(v)"),+ G_DBUS_CALL_FLAGS_NO_AUTO_START,+ CALL_TIMEOUT_MS,+ nullptr,+ &error);+ if (!reply) {+ g_clear_error(&error);+ return false;+ }++ GVariant* boxed = nullptr;+ g_variant_get(reply, "(v)", &boxed);+ const bool locked = boxed && g_variant_get_boolean(boxed);+ if (boxed)+ g_variant_unref(boxed);+ g_variant_unref(reply);+ return locked;+ }++ bool lock_via_logind() {+ GDBusConnection* connection = bus();+ if (!connection)+ return false;++ if (already_locked(connection)) {+ debug::log(INFO, "lock: session is already locked");+ return true;+ }++ GError* error = nullptr;+ GVariant* reply = g_dbus_connection_call_sync(connection,+ LOGIND_NAME,+ SESSION_PATH,+ SESSION_IFACE,+ "Lock",+ nullptr,+ nullptr,+ G_DBUS_CALL_FLAGS_NO_AUTO_START,+ CALL_TIMEOUT_MS,+ nullptr,+ &error);+ if (!reply) {+ debug::log(WARN, "lock: logind refused: {}", error ? error->message : "unknown");+ g_clear_error(&error);+ return false;+ }+ g_variant_unref(reply);+ return true;+ }++ bool run_command(const std::string& command) {+ gchar** argv = nullptr;+ GError* error = nullptr;+ if (!g_shell_parse_argv(command.c_str(), nullptr, &argv, &error)) {+ debug::log(WARN, "lock: cannot parse lock_command: {}", error ? error->message : "unknown");+ g_clear_error(&error);+ return false;+ }++ const bool spawned = g_spawn_async(nullptr,+ argv,+ nullptr,+ static_cast<GSpawnFlags>(G_SPAWN_SEARCH_PATH | G_SPAWN_CLOEXEC_PIPES),+ nullptr,+ nullptr,+ nullptr,+ &error);+ if (!spawned) {+ debug::log(WARN, "lock: {} failed to start: {}", command, error ? error->message : "unknown");+ g_clear_error(&error);+ }+ g_strfreev(argv);+ return spawned;+ }++ } // namespace++ bool lock_session(const std::string& command) {+ if (!command.empty())+ return run_command(command);+ return lock_via_logind();+ }++} // namespace tetherdiff --git a/src/gtk/settings_view.cpp b/src/gtk/settings_view.cppindex ba5a628..64a897c 100644--- a/src/gtk/settings_view.cpp+++ b/src/gtk/settings_view.cpp@@ -35,6 +35,8 @@ namespace tether::ui {GtkWidget* row_calls = nullptr;GtkWidget* sw_calls = nullptr;+ GtkWidget* sw_lock_away = nullptr;+nlohmann::json bt_status = nlohmann::json::object();};@@ -127,6 +129,10 @@ namespace tether::ui {daemon_send({{"command", "bt_set_calls"}, {"enabled", gtk_switch_get_active(widget) == TRUE}});}+ void on_lock_away_toggled(GtkSwitch* widget, GParamSpec*, gpointer) {+ daemon_send({{"command", "bt_set_lock_on_away"}, {"enabled", gtk_switch_get_active(widget) == TRUE}});+ }+void on_retention_changed(GtkComboBox* combo, gpointer) {if (const gchar* id = gtk_combo_box_get_active_id(combo))daemon_send({{"command", "bt_set_retention"}, {"retention", id}});@@ -174,6 +180,10 @@ namespace tether::ui {reinterpret_cast<gpointer>(on_popups_toggled),status.value("desktop_popups_enabled", true));+ set_switch(g_settings.sw_lock_away,+ reinterpret_cast<gpointer>(on_lock_away_toggled),+ status.value("lock_on_away", false));+const std::string retention = status.value("retention", "encrypted");set_combo(g_settings.cmb_retention, reinterpret_cast<gpointer>(on_retention_changed), retention);@@ -261,6 +271,17 @@ namespace tether::ui {_("Off silences iPhone alerts, new messages and arriving files."),g_settings.sw_popups);+ // Security+ GtkWidget* security = add_group(column, _("Security"), _("What Tether does when the iPhone leaves."));++ g_settings.sw_lock_away = new_switch();+ g_signal_connect(g_settings.sw_lock_away, "notify::active", G_CALLBACK(on_lock_away_toggled), nullptr);+ add_row(security,+ _("Lock the session when the iPhone goes out of range"),+ _("Locks about half a minute after the link times out. Switching Bluetooth off on the "+ "iPhone does not lock, and neither does suspending this machine."),+ g_settings.sw_lock_away);+// MessagesGtkWidget* messages =add_group(column, _("Messages"), _("SMS and iMessage conversations synced over Bluetooth."));diff --git a/test/test_bluetooth_pairing.cpp b/test/test_bluetooth_pairing.cppindex 7327a93..79addbf 100644--- a/test/test_bluetooth_pairing.cpp+++ b/test/test_bluetooth_pairing.cpp@@ -78,6 +78,9 @@ TEST(BluetoothConfig, RoundTrips) {config.adapter = "hci1";config.calls_enabled = true;config.desktop_popups_enabled = false;+ config.lock_on_away = true;+ config.lock_away_seconds = 45;+ config.lock_command = "hyprlock";EXPECT_EQ(deserialize_config(serialize_config(config)), config);}@@ -95,6 +98,16 @@ TEST(BluetoothConfig, DefaultsToConnectFirstAndAncsEnabled) {EXPECT_FALSE(config.calls_enabled);// A config written before the switch existed keeps showing popups.EXPECT_TRUE(config.desktop_popups_enabled);+ // Locking the screen is never assumed; logind performs it once switched on.+ EXPECT_FALSE(config.lock_on_away);+ EXPECT_EQ(config.lock_away_seconds, AWAY_LOCK_GRACE_SECONDS);+ EXPECT_TRUE(config.lock_command.empty());+}++// A zero or negative grace would lock on the first flap.+TEST(BluetoothConfig, ClampsTheAwayGraceToAtLeastASecond) {+ EXPECT_EQ(deserialize_config(R"({"lock_away_seconds": 0})").lock_away_seconds, 1);+ EXPECT_EQ(deserialize_config(R"({"lock_away_seconds": -5})").lock_away_seconds, 1);}// Switching Bluetooth off supervises no device, which is what stops the daemondiff --git a/test/test_bluetooth_supervisor.cpp b/test/test_bluetooth_supervisor.cppindex 0b71c50..a811852 100644--- a/test/test_bluetooth_supervisor.cpp+++ b/test/test_bluetooth_supervisor.cpp@@ -1068,3 +1068,74 @@ TEST(BearerSupervisor, NeverCyclesClassicWhileHandsFreeIsPresent) {sup.tick(now);EXPECT_EQ(ops.classic_disconnects, 0);}++namespace {++ // A phone that is bonded and reachable on neither bearer.+ BearerStatus gone_bearer() {+ BearerStatus s;+ s.device_present = true;+ s.device_paired = true;+ return s;+ }++} // namespace++TEST(AwayLock, LocksOnceTheGraceHasPassedAfterASupervisionTimeout) {+ const BearerStatus gone = gone_bearer();+ EXPECT_TRUE(should_lock_on_away(true, gone, false, REASON_TIMEOUT, 30, 0, 30));+}++TEST(AwayLock, WaitsOutTheGraceBeforeLocking) {+ const BearerStatus gone = gone_bearer();+ EXPECT_FALSE(should_lock_on_away(true, gone, false, REASON_TIMEOUT, 29, 0, 30));+}++// LE flaps on its own while BR/EDR carries on; that is not an absence.+TEST(AwayLock, NeverLocksWhileEitherBearerIsUp) {+ BearerStatus bearer = gone_bearer();+ bearer.classic_connected = true;+ EXPECT_FALSE(should_lock_on_away(true, bearer, false, REASON_TIMEOUT, 300, 0, 30));++ bearer.classic_connected = false;+ bearer.le_connected = true;+ EXPECT_FALSE(should_lock_on_away(true, bearer, false, REASON_TIMEOUT, 300, 0, 30));+}++// An open MAP or PBAP session reaches the phone whatever BlueZ reports.+TEST(AwayLock, NeverLocksWhileAnObexSessionIsOpen) {+ const BearerStatus gone = gone_bearer();+ EXPECT_FALSE(should_lock_on_away(true, gone, true, REASON_TIMEOUT, 300, 0, 30));+}++// Only a supervision timeout means the phone left. Local covers the daemon's own+// disconnects and the adapter powering off, Remote the phone's Bluetooth being+// switched off, Suspend this machine going to sleep.+TEST(AwayLock, LocksOnNoOtherDisconnectReason) {+ const BearerStatus gone = gone_bearer();+ for (const char* reason : {"org.bluez.Reason.Local",+ "org.bluez.Reason.Remote",+ "org.bluez.Reason.Suspend",+ "org.bluez.Reason.Authentication",+ "org.bluez.Reason.Unknown",+ ""})+ EXPECT_FALSE(should_lock_on_away(true, gone, false, reason, 300, 0, 30)) << reason;+}++// An unpaired or removed device is not a phone that walked away.+TEST(AwayLock, NeverLocksForADeviceThatIsNoLongerPaired) {+ BearerStatus bearer = gone_bearer();+ bearer.device_paired = false;+ EXPECT_FALSE(should_lock_on_away(true, bearer, false, REASON_TIMEOUT, 300, 0, 30));+}++TEST(AwayLock, NeverLocksWhenTheSettingIsOff) {+ const BearerStatus gone = gone_bearer();+ EXPECT_FALSE(should_lock_on_away(false, gone, false, REASON_TIMEOUT, 300, 0, 30));+}++// Nothing has gone down yet, so there is no absence to time.+TEST(AwayLock, NeverLocksBeforeAnythingHasGoneDown) {+ const BearerStatus gone = gone_bearer();+ EXPECT_FALSE(should_lock_on_away(true, gone, false, REASON_TIMEOUT, 300, -1, 30));+}