[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-109341":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":14,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":24,"topics":25,"createdAt":10,"pushedAt":36,"updatedAt":37,"readmeContent":38,"aiSummary":39,"trendingCount":16,"starSnapshotCount":16,"syncStatus":14,"lastSyncTime":40,"discoverSource":41},109341,"tandem","saharshbaiju\u002Ftandem","saharshbaiju","Use an Android phone as a real, low-latency second monitor for Linux","https:\u002F\u002Fsaharshbaiju.github.io\u002Ftandem\u002F",null,"Python",219,13,2,6,0,18,149,14,66.34,"GNU General Public License v3.0",false,"main",true,[26,27,28,29,30,31,32,33,34,35],"android","gnome","hyprland","linux","low-latency","screen-extender","second-monitor","spacedesk-alternative","virtual-display","wayland","2026-11-20 17:59:31","2026-11-23 18:47:25","\u003Cdiv align=\"center\">\n\n\u003Cpicture>\n  \u003Csource media=\"(prefers-color-scheme: light)\" srcset=\"logo\u002Ftandem-logo-black.png\">\n  \u003Cimg src=\"logo\u002Ftandem-logo.png\" alt=\"Tandem\" width=\"720\">\n\u003C\u002Fpicture>\n\n### Your Android phone, as a real second monitor for Linux\n\nNative, low-latency, GPU-accelerated, with touch. Drag a window onto the phone and it appears there.\n\n**[Website](https:\u002F\u002Fsaharshbaiju.github.io\u002Ftandem\u002F)** · **[Download the app](https:\u002F\u002Fgithub.com\u002Fsaharshbaiju\u002Ftandem\u002Freleases\u002Flatest)** · **[Documentation](#documentation)** · **[Architecture](docs\u002FARCHITECTURE.md)**\n\n\u003C\u002Fdiv>\n\n---\n\nTandem turns an Android phone into a second monitor for a Linux desktop. It is\nsimilar to spacedesk on Windows, but it is native, and the video path uses the GPU\nfrom end to end.\n\n| Desktop | Distributions | How the virtual monitor is made |\n| --- | --- | --- |\n| **Hyprland** | Arch, and anything else running Hyprland | `hyprctl output create headless`, with wf-recorder and VA-API. On NVIDIA, xdg-desktop-portal-hyprland and GStreamer NVENC, zero copy |\n| **GNOME on Wayland** | **Ubuntu 22.04 and newer**, **Fedora 36 and newer**, any GNOME 40 or newer | Mutter's virtual monitor API, PipeWire and GStreamer |\n\n**Touch works too.** Tap, drag, scroll and pinch on the phone to control what is on\nit. Touches go through a virtual touchscreen, so your mouse pointer stays where it\nis. Only a phone that has scanned the computer's QR code can control the desktop.\nPair by scanning the QR code shown in the terminal. Connect over a **USB cable**\n(through adb, automatically when USB debugging is on), **USB tethering** (no USB\ndebugging needed), or **Wi-Fi**.\n\n**Your monitors stay as they are.** Tandem never modifies your existing monitors:\nit adds the phone beside them and only ever changes its own virtual monitor\nand, on Hyprland, the one workspace it gives the phone.\n\n## Documentation\n\n- [`docs\u002FPLATFORMS.md`](docs\u002FPLATFORMS.md): install and setup on Arch, Ubuntu and\n  Fedora, how the GNOME backend works, and troubleshooting.\n- [`docs\u002FARCHITECTURE.md`](docs\u002FARCHITECTURE.md): the whole pipeline, the wire\n  protocol, the reliability rules, and the latency budget.\n- [`docs\u002FANDROID.md`](docs\u002FANDROID.md): the phone app, covering the UI, its\n  components, the decode path and the developer workflow.\n- [`docs\u002FSECURITY.md`](docs\u002FSECURITY.md): who can connect, how encryption works (TLS\n  with a pinned certificate), the pairing-key handshake, limits, and how it was\n  tested.\n- [`docs\u002FRELEASING.md`](docs\u002FRELEASING.md): how releases are built, signed and\n  published, as an APK and a Linux tarball on GitHub Releases.\n- [`website\u002F`](website\u002F): the landing page. It is one static file with no build\n  step. It is published to \u003Chttps:\u002F\u002Fsaharshbaiju.github.io\u002Ftandem\u002F> whenever\n  `website\u002F` changes on `main`.\n\n## Install\n\n### On the computer (Ubuntu, Fedora, Arch)\n\n```bash\ncurl -fsSL https:\u002F\u002Fraw.githubusercontent.com\u002Fsaharshbaiju\u002Ftandem\u002Fmain\u002Finstall.sh | bash\n```\n\nThen open a new terminal and run **`tandem`**.\n\nThe installer places the program in `~\u002F.local\u002Fshare\u002Ftandem` and adds the `tandem`\ncommand. If needed, it adds `~\u002F.local\u002Fbin` to your shell's PATH. It also creates a\n*Tandem* entry in the app menu, and installs the packages your distribution and\ndesktop need, using `apt`, `dnf` or `pacman`. It asks for your password once.\nRun the same line again to update. `.\u002Finstall.sh --uninstall` removes Tandem. From a\ngit checkout, `.\u002Finstall.sh` installs that checkout instead.\n\n> **Ubuntu and Fedora:** log in to the GNOME **Wayland** session, which is the\n> default. On Ubuntu, choose \"Ubuntu\", not \"Ubuntu on Xorg\". On Fedora, the H.264\n> encoder comes from the `fedora-cisco-openh264` repository, which is enabled by\n> default on Workstation.\n\n### On the phone (Android 8 and newer)\n\nDownload **`Tandem-\u003Cversion>.apk`** from the\n[latest release](https:\u002F\u002Fgithub.com\u002Fsaharshbaiju\u002Ftandem\u002Freleases\u002Flatest) on the\nphone, open it, and allow installs from your browser when asked.\n\n> **Previously used *Screen Extender* (amVD 0.4 or older)?** Tandem is a separate\n> app with its own package ID, so it installs next to the old one. Uninstall\n> *Screen Extender*, then scan the new QR code. The `-debug.apk` is a separate app\n> again, called *Tandem (debug)*, for testing.\n\n### Connect\n\n1. Run `tandem`, then choose **Start Tandem**. A QR code appears.\n2. Choose how the phone reaches the computer:\n   - **USB cable** (lowest latency): turn on *USB debugging* on the phone and plug\n     it in. `tandem` sets up `adb reverse` by itself. This works even when the\n     phone is on mobile data.\n   - **USB tethering**: *Settings → Hotspot & tethering → USB tethering*. No\n     developer options are needed.\n   - **Wi-Fi**: the phone and the computer are on the same network. If a firewall\n     is in the way, the live view says so. Press **f** to open the port. The port\n     is 5000, or the next free one if another program already uses 5000. The live\n     view shows which one is in use. For the best Wi-Fi, connect the computer\n     to the phone's own mobile hotspot. The two then talk directly, with no\n     router in between, no other devices competing for airtime and no guest or\n     campus network isolating them. The computer reaches the internet through\n     the phone's mobile data while it is connected. The video stream itself\n     stays on the hotspot link and uses no mobile data.\n\n   While it waits for the phone, the live view shows **connection checks**. They\n   cover whether USB debugging is authorised, whether a firewall is blocking the\n   port, and whether Wi-Fi is reachable. They explain why a phone cannot connect yet.\n3. In the app, tap **Scan QR code**, scan the code in the terminal, and tap\n   **Connect**. Ripples spread from your finger, and then the screen dissolves into\n   your extended desktop.\n4. Touch the phone's screen to use it. On **Hyprland**, touch needs a one-time\n   permission for `\u002Fdev\u002Fuinput`. The installer offers to set it up, or you can press\n   **t** in the live view. On **GNOME**, nothing needs to be set up.\n\nThe phone's stock camera works too. Point it at the QR code, and it opens a\n`tandem:\u002F\u002F` link in the app, which asks you to confirm the computer.\n\n**Only your phone can connect.** The QR code carries a random pairing key and the\nfingerprint of the computer's encryption certificate. Nothing is sent to a phone\nuntil both sides have proved that they know the key. Everything, including video and\ntouches, is encrypted with TLS. Other devices on the same Wi-Fi can neither watch\nthe screen nor send touches. To enter an address by hand, also type the **pairing\ncode** shown under the QR code. Details are in [`docs\u002FSECURITY.md`](docs\u002FSECURITY.md).\n\nWithout the terminal UI, `~\u002F.local\u002Fshare\u002Ftandem\u002Flinux\u002Fstart-tandem.sh usb` prints\nthe same QR code and runs the daemon in the foreground.\n\n## How it works\n\n```\nvirtual monitor (Hyprland headless output \u002F Mutter virtual monitor)\n        │  zero-copy capture\n   H.264 encode on the compositor's GPU (NVENC \u002F VA-API, x264 \u002F openh264 fallback;\n                GStreamer VA \u002F x264 \u002F openh264 on GNOME)\n        │  no B-frames, one slice per frame, CBR with a 2-frame buffer\n   tandemd.py   splits NAL units, caches the current GOP, one I\u002FO\n        │         thread per phone, 1 s heartbeats, keyframe on request (KEYQ),\n        │         restarts the encoder if it exits\n   TLS over TCP: USB tethering, Wi-Fi, or adb reverse (every QR address tried\n        │         in parallel); pairing-key proof before anything is sent\n        │                                        ▲\n   Android app → MediaCodec → Surface            │ touches, keyframe requests\n                hardware decode, rendered on arrival    (paired phones only)\n                                                 │\n   phone_input.py → virtual touchscreen: uinput (Hyprland) \u002F Mutter RemoteDesktop (GNOME)\n```\n\nTarget latency from glass to glass is about **25 to 45 ms** over USB and about\n**30 to 60 ms** over Wi-Fi, with hardware encoding. Wi-Fi is lowest on the\nphone's own hotspot.\n\n### Why it is fast\n\nThe video goes straight from the encoder to the phone's hardware decoder. There is\nno media player and no jitter buffer, and the stream is raw H.264 with no container.\nThe encoder runs on the GPU that the compositor renders on, so frames are never\ncopied between GPUs. Details are in\n[`ARCHITECTURE.md` §2](docs\u002FARCHITECTURE.md#2-why-the-pipeline-avoids-buffering).\n\n### Why it stays connected\n\nHeartbeats run in both directions. A phone that joins a still desktop receives the\ncurrent picture at once, because the daemon replays the last keyframe and the frames\nthat followed it. The same replay repairs a lost or broken frame: the phone asks for\na keyframe (`KEYQ`) and is back on the live picture within milliseconds. A phone\nthat falls more than a fraction of a second behind skips the stale frames instead of\nplaying them late. If the encoder exits, the daemon restarts it while the phone\nstays connected. If the link drops after streaming, for example when the cable is pulled,\nthe Wi-Fi roams, or a setting changes, the app shows *Reconnecting…* over the last\nframe and resumes by itself. The reliability rules, and the failures they prevent,\nare listed in [`ARCHITECTURE.md` §7](docs\u002FARCHITECTURE.md#7-failure-modes-and-the-rules-that-prevent-them).\n\n## The terminal UI\n\n```bash\ntandem\n```\n\n- **Start Tandem** launches the daemon and opens the live view. It shows the status,\n  the pairing **QR code**, the plain addresses, the touch status and the daemon log.\n  `q` returns to the menu and keeps the stream running. `d` disconnects and removes\n  the monitor.\n- **Configure** sets the desktop backend (auto, hyprland or gnome), the screen\n  **side** (left, right, up or down), the **resolution** (presets, or *Match connected\n  phone* through adb), the **FPS**, the desktop **scale**, the **quality** (bitrate),\n  the keyframe interval, the **preferred link** (which address comes first in the\n  QR code), the **port**, **touch input** (on or off), and **paired phones**. The\n  paired phones option has a *forget all* action, which creates a new pairing key.\n  Connected phones are dropped, and each one must scan the QR code again. Saving\n  while streaming applies side and scale at once. Other changes restart the stream.\n  Settings are stored in `~\u002F.config\u002Ftandem\u002Fconfig.json`.\n- **Dependencies** lists what is needed for your distribution and backend, using\n  pacman, apt or dnf. Press `i` to install what is missing.\n- **Detected hardware** shows the desktop, the primary monitor, the VA-API node, the\n  USB tether link, the phone's panel size (through adb) and the LAN IP.\n\n### The daemon directly (advanced, scripting)\n\n```bash\ncd linux\n.\u002Fstart-tandem.sh usb|wifi [flags]     # prints the QR, runs in the foreground\npython3 tandemd.py --help\n```\n\n```\n--backend auto|hyprland|gnome            # auto-detected from the session\n--width 2400 --height 1080 --fps 60      # virtual monitor mode\n--side right|left|up|down --scale 1.5    # placement (applied live on SIGUSR1)\n--bitrate 12M --gop 30                   # encoder (Hyprland: GOP is at least 1 s of frames)\n--encoder auto|vah264enc|x264enc|…       # GNOME: GStreamer element to use\n--encoder auto|h264_nvenc|h264_vaapi|libx264|libopenh264  # Hyprland: compositor GPU, CPU fallback\n--device \u002Fdev\u002Fdri\u002FrenderD128             # Hyprland: VA-API node (h264_vaapi)\n--host 0.0.0.0 --port 5000               # default: every interface, IPv4 and IPv6\n--keep-output                            # Hyprland: keep the monitor when the daemon exits\n--parent-pid PID                         # stop, and remove the monitor, when PID exits\n--pairing-key-file ~\u002F.config\u002Ftandem\u002Fpairing-key   # phones must prove this key (default)\n--tls-dir ~\u002F.config\u002Ftandem\u002Ftls                    # TLS certificate (default; created if missing)\n--no-touch                               # view only\n```\n\nSignals: SIGTERM, SIGINT and SIGHUP stop the daemon cleanly. SIGUSR1 re-reads\n`--banner-file` and applies side and scale live.\n\n## The Android app\n\nMost people install the APK from GitHub Releases, as described above. To build it\nyourself:\n\n```bash\ncd android\nJAVA_HOME=\u002Fopt\u002Fandroid-studio\u002Fjbr .\u002Fgradlew :app:assembleDebug\nadb install -r app\u002Fbuild\u002Foutputs\u002Fapk\u002Fdebug\u002Fapp-debug.apk\n```\n\nYou can also open `android\u002F` in Android Studio and press Run. The command-line build\nneeds JDK 17 to 21. If your system JDK is newer, point `JAVA_HOME` at the JBR that\nships with Android Studio. The app requires Android 8.0 or newer. Its QR scanner uses\nGoogle Play services, so the app needs no camera permission. The theme is OLED black,\nmatching the website. On Android 13 and newer, the water transition uses a shader. On\nolder phones, it uses a canvas version.\n\n## Developing\n\n```bash\npython3 linux\u002Ftestsrc.py --width 2400 --height 1080   # fake desktop, real daemon code\npython3 linux\u002Ftestsrc.py --log-touch                  # …and print the touches it receives\nadb shell am start -a android.intent.action.VIEW -d \"'tandem:\u002F\u002Fc?h=10.0.2.2&p=5000'\"   # emulator\nadb logcat -s StreamSession\n```\n\n`testsrc.py` streams a test pattern through the real broadcaster without creating a\nmonitor. That lets you develop the app on any machine. The emulator reaches the PC\nat `10.0.2.2`. More is in [`ANDROID.md` §7](docs\u002FANDROID.md#7-developer-install-and-debugging).\n\n## Project layout\n\n```\nlinux\u002F\n  tandem                TUI launcher (installed as the `tandem` command)\n  python.sh             picks the system \u002Fusr\u002Fbin\u002Fpython3 (not conda\u002Fpyenv) for\n                        tandem, start-tandem.sh and install.sh\n  tui.py                curses UI: deps, detection, config, live view + QR\n  core.py               config, distro\u002Fdependency detection, addresses, QR URI\n  qr.py                 dependency-free QR encoder (half-block terminal output)\n  tandemd.py            daemon: backend → NAL parse → GOP cache → TCP broadcast\n  secure_link.py        TLS certificate, pairing key, handshake, lock-out\n  phone_input.py        what admitted phones send back: touches → slots\n  uinput_touch.py       virtual multi-touch touchscreen via \u002Fdev\u002Fuinput (Hyprland)\n  backends\u002Fhyprland.py  headless output, hyprctl Lua API, wf-recorder, touch mapping\n  backends\u002Fxdph.py      NVIDIA: zero-copy capture via the Hyprland portal + GStreamer NVENC\n  backends\u002Fgnome.py     Mutter ScreenCast virtual monitor, DisplayConfig, GStreamer,\n                        RemoteDesktop touch\n  start-tandem.sh       no-TUI launcher (prints the QR)\n  testsrc.py            test-pattern server for app development\n  about.py              the credit line and license notice (printed by --version)\nandroid\u002Fapp\u002Fsrc\u002Fmain\u002Fjava\u002Fio\u002Fgithub\u002Fsaharshbaiju\u002Ftandem\u002F\n  MainActivity.kt       Material 3 UI, scanner, transitions, side sheet\n  StreamSession.kt      parallel connect, framed reader, MediaCodec → Surface\n  RippleRevealLayout.kt water ripple and reveal (AGSL)\n  ConnectTarget.kt      tandem:\u002F\u002F QR and deep-link parsing (pairing key, cert fingerprint)\n  SecureChannel.kt      TLS, certificate pinning and the pairing proof\n  FrameReader.kt        NALU \u002F ASX1 \u002F PING \u002F INPT framing\n  FrameWriter.kt        HELO \u002F AUTH \u002F TUCH (phone to computer)\n  TouchForwarder.kt     MotionEvent → touch frames\n  AspectRatioSurfaceView.kt  letterboxing\nLICENSE, NOTICE          GPL-3.0 and its additional terms (see License below)\ndocs\u002F                    PLATFORMS, ARCHITECTURE, ANDROID, SECURITY, RELEASING\ninstall.sh               one-line installer (any distribution), adds the `tandem` command\n```\n\n## Roadmap\n\n- RTP over UDP with forward error correction for lossy Wi-Fi (TCP stays for USB)\n- HEVC decoding in the app\n- A KDE Plasma backend\n- Pen input with pressure and hover, and typing from the phone\n- A latency overlay\n\n## License\n\nTandem is free software under the [GNU GPL version 3](LICENSE), with three\nadditional terms allowed by its section 7. They are written out in [NOTICE](NOTICE):\n\n- **Keep the credit.** The app's connect screen and `tandem --version` \u002F\n  `tandemd.py --version` show *Tandem by Saharsh Baiju ·\n  github.com\u002Fsaharshbaiju\u002Ftandem*. Copies and modified versions must keep that\n  notice, and they may add their own names next to it.\n- **Use your own name.** A distributed fork must not call itself Tandem, or suggest\n  that it is the original.\n- **Google Play services is allowed.** The Android app's QR scanner comes from\n  Google Play services, which is not free software. Linking with it is permitted.\n\nCopyright (C) 2026 Saharsh Baiju.\n","Tandem 是一个将 Android 手机用作 Linux 桌面低延迟第二显示器的开源工具。它支持 Hyprland 和 GNOME（Wayland）环境，通过 GPU 加速视频编码（VA-API\u002FNVENC）、PipeWire 采集与 GStreamer 解码实现端到端硬件加速，延迟显著低于传统投屏方案；同时原生支持触摸交互（点击、拖拽、缩放），并通过 QR 码配对与 TLS 加密保障连接安全。适用于开发者、多任务办公用户及需要便携扩展屏的 Linux 桌面场景，无需修改现有显示配置，仅新增虚拟显示器。","2026-11-24 04:36:33","CREATED_QUERY"]