Skip to content

All your computers and your phone/iPhone, working as one desk. Screens, apps, files, clipboard, calls, texts, notifications, mouse and keyboard, shared between Mac, Windows, Linux , Android, Web and ios / ipados . Free and open source. No account, no cloud, and no shared network needed.

19.8 KB
Raw Blame

Capabilities: what a pair of devices can do

Two TwinDesk devices can differ in what they can do: a different version, a different kind of device (a computer, an Android phone, an iPhone, a browser), a different OS, or a setting or permission that one side doesn't have. This page lists every capability the apps tell each other today, where each one is sent, and what it switches on.

The rule: a page, a switch or a button is offered only when both devices can do it. When one side can't, the app says which side and what would enable it (update it, grant a permission, turn on wireless debugging), instead of offering something that won't work.

This page goes with the wire protocol in protocol.md. New capabilities are added here in the same change that adds them to the code.

Versions

What Where Value now
Protocol version PROTOCOL_VERSION in shared/protocol.js, sent as v in hello, welcome and beacons 1
App version app.v in dev.state (shared/appinfo.js), and app in phone.info the app's version, e.g. 3.1.0

The protocol version changes only for a change an older app can't ignore. Everything else is added as a new field or a new message, which an app that doesn't know it ignores. So new features are found by capability, not by comparing version numbers. The app version is for people: Overview shows the other side's version, in red when it's older.

Session capabilities (hello and welcome)

The device that dials sends hello, and the one that answers sends welcome. Each new capability is a field in one or both. A missing field means "can't", so an older app gets the old behaviour.

Field Sent in Meaning Falls back to
fx: 1 / fx: token hello / welcome Fast files: file bytes over HTTPS on the session's port file.chunk on the session
fx2: 1 hello and welcome fx2: the file engine in its own process, parallel ranges fx, then file.chunk
fxPlain: 1 hello and welcome Unencrypted file bytes allowed on the local network (Files › Encrypt file transfers off on both) encrypted fx2
il: {…} hello and welcome tdv2: the encrypted UDP input lane, with its port tdv1 (input on the session)
rc: 1 hello / welcome (and the beacon) A paired phone may return to its session without taking it over (Mac; Windows and Linux too since #266) plain hello (takes the session)
resume: key welcome, then hello The session may move to another path (Bluetooth to Wi-Fi, the cable) without ending a new session
tail: [addresses] welcome This computer's Tailscale addresses, for reaching it away from home (#161) local discovery only
takeover: true hello Take the session from the device that holds it refused while busy

Clipboard policy

clip.policy says what a device wants from the other side's clipboard: accept, images, and queue: true when it understands clip.queue {items: [{text, at}]}, the copies made while it was away (shared/clipqueue.js). Without queue nothing is queued for it.

Features in dev.state

Each side lists the features that need TwinDesk on both sides in dev.state as app.f (shared/appinfo.js). When the other side lacks one this side has, the app says so once per session, naming the feature.

Id Feature
lane Faster mouse and keyboard (tdv2)
fastFiles Faster file transfers (fx2)
h265 H.265 screen sharing
chats Chat apps in Messages

A device that sends no app at all is older than 2.5, and the app can't tell which features it lacks, so it shows only that it's older.

Lighter Overview controls (dev.state)

Field Sent in Meaning An app without it
battery, charging dev.state (a computer's) A laptop's battery, shown on its page on the other computer (read with the rest of the state, so only while that page may be looked at) no battery shown
asks: 1 dev.state This computer asks for the other side's controls (ask: true) while its window is on screen, at once and every minute. The other side then reads its own volume, Bluetooth and Do not disturb only while asked in the last 2½ minutes, not every minute of the session (shared/devctl.js) the other side reads them every minute, as before

Features that say hello on their own

Some features don't wait for hello and welcome. They send their own first message once switched on, and start only when the other side answers.

Message Feature An app without it
drive.hello {v: 1} TwinDesk Drive or Shared folders (drive.md), both sides switched on ignores it, so Drive never starts
drive.folders {list} (after drive.hello) Shared folders, each with its own devices (drive.md) an older app never sends it and is never sent a folder's f messages; only the main folder syncs with it
audio.outs {outs, route, lat} (receiver to sender, while the sender's sound plays there) Audio › the mixer: the receiver's speakers, the route it keeps for that sender and the delay heard (shared/sound-route.js) an older receiver never sends it: the sender's mixer shows that computer with no speakers to pick, and its sound plays on its default speaker, as before
audio.route {outs?, sync?} (sender to receiver) Audio › the mixer: the sender's pick of the receiver's speakers, and Keep speakers in sync (ms) an older receiver ignores it
mesh.ask (phone to computer) The mesh's computers, read only, on the phone's Overview › Computers (shared/mesh-view.js, MeshMgr.kt, MeshMgr.swift): mesh.view {me, devices} back an older computer ignores it, so the phone shows no Computers card; an older phone's mesh.do gets mesh.done {ok: false, why: off}
unlock.hi {key} (phone or computer to a Full KVM computer, at every welcome) Biometric unlock (full-kvm.md): the key it holds there. The computer answers unlock.state {on, set, locked, name, key?, off?}; then unlock.want / unlock.ask / unlock.sign / unlock.no / unlock.done / unlock.end, and Add device's unlock.enroll / unlock.key / unlock.saved, unlock.forget an older computer ignores it: no Unlock on the device; an older device never sends it, so the Full KVM tab can't add it
mesh.dev {…, batt: {level, charging}} (pool, computer to computer) A laptop's battery on the phone's Overview › Computers (mesh.view's devices get battery, charging); read at most every minute (Linux), two (Mac) or five (Windows), never again on a computer without one an older computer never sends it: no battery shown for it; an older phone ignores the fields
mgr.dev {mgr, pro, can, grants, asks, locked, wakes} (pool), mgr.offer {perm, on}, mgr.cmd {rid, do} / mgr.res (direct, manager to computer) Mesh managers (shared/mesh-mgr.js): a TwinDesk Professional computer or a Mac picks computers, each accepts Power and, on TwinDesk Professional, Biometric unlock on its own screen; commands only on the manager's own session an older computer ignores them: it can't be added, and the manager shows it as not available
pad.state {n, b, lx, ly, rx, ry, lt, rt}, pad.off (computer to the computer picked) Controller sharing (Camera and controllers, shared/pad-share.js); also on the input lane as PAD (type 5) when it's up, the newest n wins an older computer ignores them, so it's never picked as playing; an older lane drops type 5 and the session's copy still comes
pad.offer {pads} (sharer to the computers it picked) Controller sharing: the controllers shared with this computer, so the receiver picks the one that plays (only one at a time) an older receiver ignores it and takes the first that plays, as before
task.alert.policy {on} (phone to computer), task.alert {id, title, ok} (computer to phone) Task alerts (shared/task-alerts.js, #378): a command run through twindesk-notify ended an older phone never sends the policy, so it's never sent an alert
phone.info caps: ['capture'] (iPhone) Take a photo and Scan document from an iPhone (shared/phonephoto.js, Capture.swift, #382) an older iPhone app isn't offered either; an Android phone always is
phone.info display (phone to its computer), layout.displays phones (computer to computer) A phone or tablet at its real size and way round on the monitor map (#375) an older phone keeps the default phone shape
layout whole: [ids] Use the whole edge (Multi-device › Layout, #376), followed by every computer an older computer keeps one-to-one crossing
tether.state {can: true} (phone to computer, as its session starts) Internet over USB (shared/tether.js, Tether.kt) an older phone never sends it, so the computer shows no Internet over USB card and never sends tether; an older computer ignores it
phonenet.state {can: true} (phone to computer, as its session starts) The phone's internet on the computer (shared/phonenet.js, PhoneNet.kt, #361) an older phone never sends it, so the computer shows no Phone's internet card and never sends phonenet; an older computer ignores it. The Windows proxy needs a helper with sysProxyGet/sysProxySet (an older one: the card says to update)
drop.hi {ids, gone, since?} (either way, as a link comes up) Drop (shared/drop.js, Drop.kt, Drop.swift): each side lists the messages it has; the other sends what's missing (drop.msgs), then new ones as drop.msg and deletions as drop.del an older app ignores it, so no Drop messages go to or come from it
drop.who (phone to computer; the computer answers {members}) Drop's To picker on a phone: the devices in the conversation, the computer first an older computer never answers: the phone offers Everyone only
phone.screens {phones: [{id, name}]} (pool, computer to computer) An Android phone's screen from any computer of the mesh (shared/android-relay.js, #363): the computer the phone is connected to lists the phones it serves; the others open them through phone.mirror.want and phone.media.want as for an iPhone on a cable an older computer never sends it, so its phones show only on it; an older computer ignores the list
phone.dbg / phone.dbg.res (computer to computer) Debug for a phone from any computer of the mesh (shared/phone-debug.js, #363): the phone's computer answers with its log, status, files and a screenshot an older computer never answers: the phone is debugged only from the computer it is connected to
kvm.take {portal: {target, offset}} (with side and offset too) Cursor portals (shared/cursor-portals.js): the computer (Mac, Windows or Linux) places the pointer on the portal's range and arms the way back there (portalCapabilities 3 in its helper; placePortal, armReturn {portal}) an app without portals places the pointer by side and offset, as an ordinary crossing

Screen sharing to a phone (offer and screen.state fields)

Each is switched on by a field the computer sends; the messages themselves are described in shared/protocol.js.

Field Sent in Meaning An app without it
detail {baseline, fps, sizes} rtc2.offer (Mac, Windows, Linux) The sizes this screen share can be sent at. The phone pinches to zoom and asks for one with rtc.detail {session, height}, which counts only from the socket the share was offered on (#286) no detail: the phone keeps one size and has no pinch or three-finger pan; an older phone never sends rtc.detail
input: true|false screen.state Whether this computer applies the share's input now; the phone shows its touchpad ring only while true (#288) no ring
spaces, desktops, spaceHold screen.state (Mac only) Previous/next desktop on the display being shown, the catalog of its displays and desktops, and why remote control is paused (Mission Control open, accessibility unreadable). In Multi-device each device's message is for the display it is shown (#264) no Displays & desktops sheet; the bar keeps Mirror, Extend and the display list
screen.preview.want answered by screen.preview Mac only A still of each desktop while the phone's sheet is open, one device at a time; unavailable on macOS 13 or without Screen Recording no stills (the sheet says Not previewed yet)
multi: true screen.policy (viewer to sharer) This viewer takes extra streams: a second screen of the same computer comes as stream ch 1 to 3 (shared/screen-ch.js), its messages tagged ch; stream 0 never carries ch a second screen replaces the first, as before
place screen.state The viewer's display id the picture fills (Share screen map); several on one monitor share it in a grid (shared/screen-place.js) the window opens where it always did

Phone capabilities

Message Field Values Used for
phone.info (phone to computer) caps mirror.native: the phone can share its own screen without wireless debugging the Screen page offers mirroring in Limited mode
phone.info (TV to computer) caps tv: TwinDesk TV (android-tv/), a phone on the wire that takes only the screen, the sound, files and the cursor and keyboard the computer shows it as a TV, with only those pages (below)
beacon (TV) tv: 1 the same, before it connects a TV icon in the computers' lists
beacon (TV) ap: 1, phost the TV hosts phones (Connect with Android, android-tv/.../Phones.kt) phones list it, as a TV
peer.info (TV to phone) caps: ['tv', 'trackpad'] a TV: no clipboard, notifications, screen or files yet the phone shows only Overview, Connection and Remote (its trackpad)
tv.move {dx, dy}, tv.click {long}, tv.scroll {dx, dy}, tv.key {k} (phone to TV) the trackpad, in dp on the phone; k is back, home, recents, up, down, left, right or ok the TV moves its pointer and taps where it is (InputService)
tv.state {input} (TV to phone) whether TwinDesk TV is on in the TV's Accessibility the phone says how to switch it on
peer.info (phone to phone) caps clip, notifs, files, screen, photos, sound, and messages and fs only while that permission is granted the pages a phone shows for the other phone

Richer notifications and messages (3.2.1). Each is a field an older app ignores:

Message Field Meaning An app without it
notif.policy (computer to phone) rich: true This computer shows pictures and live progress (Pop-ups: TwinDesk, one-to-one and Multi-device), so the phone may send them. Pop-ups: System sends rich: false the phone sends neither, and skips ongoing progress notifications as before
notif (phone to computer) live: {v, max, ind?, done?} A progress bar or timer, updated in place (at most once a second, always when done) shown once as plain text
notif pic, avatar A notification's picture (a JPEG data URL up to 480 px) and the person's or chat's picture (72 px) not shown
chat.conv avatar The chat's picture in Messages a letter
sms.threads photo per thread The contact's photo, for a thread with one other person a letter
media.albums (ask and answer) albums: [{id, name, n, cover}] Photos' album sidebar no sidebar, the whole library as before
media.list album Only one album's items the whole library
hub.state (phone to computer) media.backup: true The phone answers media.index, media.has and media.backup (Photo backup, shared/photo-backup.js) Photos › settings says to update the phone app; nothing is asked
hub.policy (computer to phone) backup: true Photo backup is on with albums picked: the phone watches its library and sends media.changed (once things settle, 10 s) the phone watches nothing
media.index (ask and answer) {album, before, n, videos} / {items: [{key, id, name, at, size, video}], more, next} One album's items, light; key stays the same across sessions not sent: the phone didn't say media.backup
media.has (ask and answer) keys Which backed-up items are still in the library (Remove here what's removed on the phone) nothing is removed here
media.backup {id, batch}; answer {batch, ok: false, gone} when it can't be read One file as file.offer drop backup of that batch: accepted only for a batch the computer asked for, into the album's folder, without a window, Recent or notifications not sent

A phone that sends no caps is older. For phone to phone, an older Android phone is taken to have all of them, and an older iPhone has no messages, fs or sound.

Local only, no capability needed (the other side never knows): Notifications › Look (Card or Capsule, both count as Pop-ups: TwinDesk for rich, #355); Keyboard › Modifier keys (keys.modMap, applied by the computer that receives the keys, just before injection, shared/modmap.js); Linux's General › Network for TwinDesk (net.iface, the order of this computer's own addresses, #350).

Link capabilities

Message Fields Used for
net.caps host, join, hotspot, band5 Which side can host a Wi-Fi Direct group or a hotspot, and whether it joins 5 GHz, when a Bluetooth session needs more bandwidth (shared/netlink.js)
net.need why: 'fallback' Network fallback (General, off by default): the network dropped, keep a link up for the session until released. Any why is a reason to host, so an older phone hosts it too
net.lan (phone to computer) none The phone's own Wi-Fi is back while it hosts a fallback link: the computer releases it and the session moves onto the network again. An older phone never sends it: the link stays until the session ends or Back to Bluetooth
deck.state (ask) obs: true An OBS tile's editor wants OBS Studio's scenes and sources; the answer's state.obs is {on, record, paused, stream, vcam, scene, scenes, inputs} or {on: false, why}. Sent without the ask only when a tile uses OBS. A computer without OBS tiles ignores it
deck.layout can, caps Which Deck actions this computer can run, so the phone's tile editor offers only those

Per-device pages

Pages are chosen by the kind of device in session (shared/ui-kinds.js): computer, android, ios or tv, plus TwinDesk Web's own pages. A TV (caps: ['tv'] in phone.info) gets its own Overview, and of the pages without a for only TV_PAGES: Share screen, Audio, File Sharing, Cursor, Keyboard and this computer's own settings. A page lists the kinds it's for: Calls, Messages and Mount are for: ['android'], because iOS gives no app its calls or texts and Mount goes through adb. On top of that, each page can hide itself when its feature can't run (a permission, the OS, wireless debugging).

Two-way switches

pair.sync keeps the switches that belong to the pair (Clipboard, Notifications, Sound and the rest, each way on its own) the same on both devices. A switch for a feature the other side can't do should show dimmed with the reason, not as on (see What's still to do).

Adding a capability

  1. Add the field or the id to the right table here, with what it means and what it falls back to.
  2. Send it from every app that has the feature: Mac, Windows and Linux (shared/), Android (Kotlin) and iPhone (Swift), and TwinDesk Web where it applies.
  3. Gate the page, switch or button on both sides having it, and say what's missing when one doesn't.
  4. Keep the old path working for an app that doesn't send it.
  5. Add a test with an older peer (no field) and a newer one.

What's still to do

The pieces above grew one feature at a time, so they're in several places. The next step is one capability list per device, sent once in welcome and hello (caps: [...]), from which every page, switch and button decides whether to show. The fields above stay for older apps.