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.
// Multi-device sidebar (mac/mesh/ui-start.js, windows/mesh/app.js, linux/mesh/app.js): a TwinDesk TV
// or a TwinDesk Web device picked shows only the pages it can use. The others still work between
// this computer and the mesh's other computers, so they stay reachable below a line, "With {name}":
// one button each; a click selects that computer and opens the page there.
// UI.meshRest(nav, views, s, open): after the sidebar hid what the device can't use.
// open(id, computerId, selected): select that computer (unless it is), then show page id.
'use strict';
(function () {
const { el } = UI;
const tr = (...a) => window.I18n.t(...a);
const M = window.SidebarModel;
let head = null;
const items = new Map(); // page id → its <li> below the line
// The computer the rest of the pages go to: with a web device picked, the selected computer if
// there is one; else the first connected computer of the mesh.
function computerOf(s) {
const pcs = (s.peers || []).filter((p) => p && p.connected && !(p.via && p.via.length) && M.kindOf(p.os) === 'computer');
return (UI.webDev && pcs.find((p) => p.selected)) || pcs.find((p) => !p.selected) || null;
}
// A page for computers that the picked device doesn't show.
function isRest(v) {
const d = v.def;
if (d.web || d.bottom || d.navHidden || !v.navBtn.parentElement) return false;
if (Array.isArray(d.for) && !d.for.includes('computer')) return false;
if (!M.sectionVisible(d.id, 'computer')) return false;
return v.navBtn.parentElement.hidden;
}
UI.meshRest = function (nav, views, s, open) {
const limited = !!UI.webDev || UI.deviceKind(s) === 'tv';
const pc = limited ? computerOf(s) : null;
const rest = pc ? [...views.values()].filter(isRest) : [];
const bottom = nav.querySelector('.sep'); // the line above General and About: the rest goes before it
if (!head) {
const label = el('span', { class: 'mesh-rest-label' });
label.style.cssText = 'display:block;padding:10px 12px 4px;font-size:11px;font-weight:600;opacity:0.6;text-transform:none';
head = el('li', { class: 'gap rule mesh-rest-head', attrs: { role: 'presentation' } }, [label]);
head.style.height = 'auto';
nav.insertBefore(head, bottom);
}
head.hidden = !rest.length;
if (pc) head.firstChild.textContent = tr('With {name}', { name: pc.name || tr('another computer') });
const want = new Set(rest.map((v) => v.def.id));
for (const [id, li] of items) li.hidden = !want.has(id);
let after = head;
for (const v of rest) {
let li = items.get(v.def.id);
if (!li) {
const b = el('button', { class: 'nav-item', attrs: { title: tr('Opens it for {name}', { name: pc.name || '' }) } });
for (const part of v.navBtn.querySelectorAll('.tile, .label')) b.append(part.cloneNode(true));
b.onclick = () => { const c = computerOf(UI.state || s); if (c) open(v.def.id, c.id, !!c.selected); };
li = el('li', {}, [b]);
items.set(v.def.id, li);
}
if (li.previousSibling !== after) after.after(li); // in the sidebar's order, under the line
li.hidden = false;
after = li;
}
};
})();