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.
JavaScript androidapple-ecosystemconnectelectronfile-sharingintel-unison-alternativeiosios-windowskde-connect-alternativekvmlinuxmacbookmacosmouse-sharingphone-link-alternativeproductivityscreen-sharingsidecar-alternativesynergy-alternativewindows
// TwinDesk — Copyright (C) 2026 inukaasith. GPL-3.0, see LICENSE.
// The Terminal page in Multi-device (shared/ui-term-mesh.js): every computer of the mesh, whether it may
// open a terminal here (asked and allowed on this computer: shared/pairsync-mesh.js GUARD), whether this
// computer opens one there (asked from here, allowed there), its nickname and `ssh twindesk-<name>`, and
// the requests waiting for an answer here.
// termMeshView({ selfId, selfName, devices() → [{id, name, os, connected}], consent, pairSync, names, unit(id) → {ready, why} })
// → { me: {id, name, nick, alias}, devices: [{id, name, nick, alias, connected, here, there, ready, why, asked}], asks: [{id, name, at}] }
'use strict';
const P = require('./protocol.js');
function termMeshView({ selfId, selfName, devices, consent, pairSync, names, unit }) {
const asks = pairSync ? pairSync.asks().filter((a) => a.feature === 'terminal') : [];
const asked = new Set(asks.map((a) => a.id));
const list = (devices() || []).filter((d) => d && d.id && d.id !== selfId && !P.isPhoneOs(d.os)).slice(0, 32);
const nameOf = (id) => (list.find((d) => d.id === id) || {}).name || id.slice(0, 8);
return {
me: { id: selfId, name: selfName, nick: names ? names.nick(selfId) : '', alias: names ? names.alias(selfId, selfName) : '' },
devices: list.map((d) => {
const u = (unit && unit(d.id)) || {};
return {
id: d.id, name: d.name || d.id.slice(0, 8), nick: names ? names.nick(d.id) : '', alias: names ? names.alias(d.id, d.name) : '',
connected: !!d.connected,
here: !!(consent && consent.get(d.id, 'terminal', 'out')), // it may open a terminal here
there: !!(consent && consent.get(d.id, 'terminal', 'in')), // this computer opens one there (asked)
ready: !!u.ready, why: u.why || '',
asked: asked.has(d.id),
};
}),
asks: asks.map((a) => ({ id: a.id, name: nameOf(a.id), at: a.at })),
};
}
module.exports = { termMeshView };