Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ADR-0006: Linux process model: tetherd + D-Bus + GTK app + CLI

  • Status: accepted
  • Date: 2026-11-08
  • Deciders: maintainer, after the November 2026 research round
  • Tags: linux, architecture, packaging

Context

Phone sync must keep working when no window is open: notifications must appear, battery must update in the tray, files must arrive. At the same time the desktop UI must be restartable, replaceable (GTK today, a GNOME Shell extension or a KDE applet later) and scriptable. The target desktops are Cinnamon on X11 today and GNOME on Wayland tomorrow; both are freedesktop-compliant.

Relevant platform facts:

  • Desktop notifications are a D-Bus service, org.freedesktop.Notifications, implemented by every major shell. Actions (actions capability), replace-by-id, icons by path, and ActionInvoked/NotificationClosed signals are standard; inline reply is not (a inline-reply hint exists only in some servers), so replies need our own UI.
  • Tray icons are org.kde.StatusNotifierItem (SNI). Cinnamon, KDE and Xfce support it natively; GNOME needs the AppIndicator extension. A GNOME Shell extension can provide a first-class indicator later by consuming our D-Bus API.
  • systemd user units and D-Bus activation are the standard ways to run a per-user daemon on these distributions; SystemdService= in the D-Bus service file ties the two so there is exactly one instance.
  • The daemon needs the session bus (notifications, Avahi via the system bus is also fine) and the user’s $XDG_* directories (identity, trusted devices, ~/Downloads/Tether). It must not run as root.

Prior Linux attempts (GSConnect as a Shell extension, Sefirah/Vortex/Linksy as app-plus-service) validate the daemon-plus-client shape and show that extension-only designs lock out non-GNOME desktops.

Decision

  • tetherd (Rust, tokio): owns identity, TLS listener/dialer, discovery, pairing, sessions, plugins (battery, notifications, deviceinfo in M1) and the caches. Runs as a systemd user service (tetherd.service, WantedBy=default.target, PartOf=graphical-session.target, Restart=on-failure) and is D-Bus activatable on the session bus as org.tether.Daemon (SystemdService=tetherd.service). Logs to journald via tracing.
  • D-Bus API at /org/tether/Daemon (org.tether.Daemon1) and /org/tether/Devices/<id> (org.tether.Device1) is the only interface between the daemon and any UI; it is a documented contract (docs/reference/dbus-api.md) with properties, methods and signals.
  • Desktop notifications are emitted by the daemon through org.freedesktop.Notifications so they work with no Tether window open: phone notification → desktop notification with replaces_id, actions mapped to Android actions, icon from the blob cache; ActionInvoked → NotificationActionRequest; NotificationClosed(reason=dismissed) → NotificationDismiss; a reply action emits ReplyRequested on D-Bus so the GTK app can open its reply box.
  • tether (GTK4/libadwaita, crate tether-gtk) is a pure D-Bus client: device list, device page (battery, notifications with inline reply), pairing (QR + SAS), manual address, preferences. It also hosts the StatusNotifierItem tray (via ksni) because SNI needs a long-lived process with a menu; the app runs in the background when the window is closed if the tray is available.
  • tether-cli is a D-Bus client for scripting and support (devices, pair, qr, unpair, notify-test, log).
  • One package tether (ADR-0008) ships all three binaries plus the unit, D-Bus service file, desktop entry, icon and ufw profile.

Consequences

Positive

  • Sync is independent of any window; the UI can crash or be swapped without dropping the phone connection.
  • Multiple front-ends (GTK, CLI, future Shell extension/KDE applet) against one stable API; the API doubles as the test seam for the daemon.
  • D-Bus activation means a user who only ever opens the app still gets the daemon started correctly, and the unit gives autostart at login.
  • Freedesktop notifications and SNI work the same on Cinnamon, GNOME (with extension), KDE and Xfce.

Negative / risks

  • Every feature needs a D-Bus surface in addition to the protocol surface. Mitigation: keep D-Bus shapes close to the protobuf messages; generate documentation from the interface.
  • GNOME without an AppIndicator extension has no tray. Mitigation: documented; notifications still work from the daemon; a GNOME Shell extension is planned (M5).
  • Inline reply from the notification popup is not possible on most shells; the user gets a “Reply” action that focuses the app. Accepted (Phone Link on Windows has the same two-step for most apps).
  • Wayland clipboard sync (M2) cannot be done from a daemon without focus; it will live in the GTK app or a portal, X11 via XFixes in the daemon. Documented in the M2 plan.
  • PartOf=graphical-session.target stops the daemon at logout, which is what we want for a session-bound device; headless/lingering use (receive files while logged out) is not supported in M1.

Alternatives considered

  • Single GTK process with the daemon embedded: closing the window would disconnect the phone, and the process would depend on a display. Rejected.
  • GNOME Shell extension as the product (GSConnect model, JavaScript): excludes Cinnamon/KDE/Xfce and ties releases to Shell versions. Rejected; planned later as a client.
  • System service (/etc/systemd/system) running as a dedicated user: cannot post to the user’s session bus for notifications, cannot see the user’s files, and needs IPC to the session anyway. Rejected.
  • KDE Connect plugin: Qt, protocol (ADR-0002) and project governance mismatch. Rejected.
  • GApplication-style D-Bus singleton with autostart .desktop instead of a systemd unit: works on XDG autostart desktops but has no restart-on-failure and no journald integration. Rejected in favour of the unit plus D-Bus activation.