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, Erdoğan Yeşil. GPL-3.0, see LICENSE.
'use strict';
// Every shared module an app requires has to be in its installer. A list kept by hand once left the
// Windows installer without shared/mesh.js: the installed app died at start ("Cannot find module").
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const ROOT = path.join(__dirname, '..', '..');
const read = (f) => fs.readFileSync(path.join(ROOT, f), 'utf8');
const shared = fs.readdirSync(path.join(ROOT, 'shared')).filter((f) => f.endsWith('.js'));
// 1. what the apps require from shared/ exists there (the app folders and their multi-device mesh/ folders)
const required = new Set();
for (const dir of ['windows', 'mac', 'linux', 'windows/mesh', 'mac/mesh', 'linux/mesh']) {
if (!fs.existsSync(path.join(ROOT, dir))) continue;
for (const f of fs.readdirSync(path.join(ROOT, dir)).filter((n) => n.endsWith('.js'))) {
for (const m of read(`${dir}/${f}`).matchAll(/require\('(?:\.\.\/)+shared\/([a-z0-9-]+(?:\.js)?)'\)/g)) {
required.add(m[1].endsWith('.js') ? m[1] : `${m[1]}.js`);
}
}
}
for (const f of required) assert.ok(shared.includes(f), `shared/${f} is required but missing`);
// 2. the installers stage the WHOLE shared folder, not a list
for (const f of ['windows/installer/build.js', 'linux/installer/build.js']) {
const s = read(f);
const perFile = /readdirSync\(path\.join\(ROOT, 'shared'\)\)/.test(s) && /\.\(js\|css\|html\)/.test(s);
const wholeDir = /copy\(path\.join\(ROOT, 'shared'\), path\.join\(STAGE, 'shared'\)/.test(s) && /\.\(js\|css\|html\)/.test(s);
assert.ok(perFile || wholeDir, `${f} copies every shared/*.js`);
assert.ok(!/copy\(path\.join\(ROOT, 'shared', '(?!protocol)[a-z-]+\.js'\)/.test(s), `${f} has no hand-kept list of shared files`);
assert.ok(/name === 'lang'/.test(s), `${f} stages shared/lang for shared player imports`);
assert.ok(/name === 'airplay'/.test(s), `${f} stages shared/airplay (the AirPlay receiver)`);
}
// The Windows filter applies at every depth: the receiver's wasm has to pass it too.
assert.ok(/name === 'playfair\.wasm'/.test(read('windows/installer/build.js')), 'windows/installer/build.js stages shared/airplay/playfair.wasm');
const macBuild = read('mac/build-app.sh');
const stageShared = macBuild.split('\n').find((line) => line.startsWith('cp "$ROOT"/shared/*.js') && line.endsWith('"$STAGE/shared/"'));
assert.ok(stageShared, 'mac/build-app.sh copies every shared/*.js');
assert.ok(stageShared.includes('"$ROOT"/shared/*.html'), 'mac/build-app.sh copies every shared/*.html');
assert.ok(/cp -R "\$ROOT\/shared\/lang"/.test(macBuild), 'mac/build-app.sh stages shared/lang');
const stageMac = macBuild.split('\n').find((line) => line.startsWith('rsync -a ') && line.endsWith('./ "$STAGE/mac/"'));
assert.ok(stageMac, 'mac/build-app.sh stages the Mac app directory');
assert.ok(fs.existsSync(path.join(ROOT, 'mac', 'proximity-lock.js')) && !stageMac.includes('--exclude proximity-lock.js'), 'the Mac lock action is staged');
for (const file of ['proximity-lock.js', 'proximity-lock-desktop.js', 'proximity-lock-linux.js',
'proximity-lock-prompt.js', 'proximity-lock.html', 'preload-proximity-lock.js']) {
assert.ok(fs.existsSync(path.join(ROOT, 'shared', file)), `shared/${file} is staged by all three desktop installers`);
}
console.log(`packaging: passed (${required.size} shared modules required, all staged)`);