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 Deck's look, ready-made pages and files to share (#362, shared/deck-model.js).
// Run with: node shared/test/deck-look.js
'use strict';
const assert = require('assert');
const M = require('../deck-model.js');
// A layout without a look gets the Deck as it always looked; out-of-range values are brought in.
assert.deepStrictEqual(M.normalize(M.starter()).look, M.LOOK);
assert.deepStrictEqual(M.look({ style: 'neon', text: 9, gap: -3, radius: 99, bg: 'red', dim: 120, alpha: 400, blur: -1 }), { style: 'solid', text: 1.5, gap: 0, radius: 28, bg: '', dim: 90, alpha: 100, blur: 0 });
// Tile opacity: under 10 (or not a number) is the device's own choice.
assert.strictEqual(M.look({ alpha: 5 }).alpha, 0);
assert.strictEqual(M.look({ alpha: '50' }).alpha, 0);
assert.strictEqual(M.look({ alpha: 55 }).alpha, 55);
assert.strictEqual(M.look({}).dim, 28);
assert.strictEqual(M.look({ bg: '#AABBCC' }).bg, '#aabbcc');
for (const v of Object.values(M.LOOKS)) assert.deepStrictEqual(M.look(v), v);
// Every ready-made page keeps all its tiles, held either way, with fresh ids.
for (const n of M.TEMPLATES) {
const a = M.template(n), b = M.template(n, 'portrait'), c = M.template(n);
assert.strictEqual(a.tiles.length, b.tiles.length, n);
assert.ok(a.tiles.length >= 6, n);
assert.deepStrictEqual([a.cols, a.rows], [7, 4]);
assert.deepStrictEqual([b.cols, b.rows], [4, 7]);
assert.ok(a.tiles.every((t) => t.action.k !== 'none'), n);
assert.notStrictEqual(a.tiles[0].id, c.tiles[0].id);
}
// A page as a file: no paths of this computer's; it comes back as a new page of the space.
const l = M.normalize(M.starter());
l.spaces[0].pages[0].tiles.push({ id: 'o', x: 3, y: 1, w: 1, h: 1, label: 'Notes', icon: '', color: '#2c2c2e', action: { k: 'open', path: '/home/me/secret.txt' } });
const L = M.normalize(l);
const f = JSON.parse(JSON.stringify(M.pageFile(L, 'deck', 'main')));
assert.ok(!JSON.stringify(f).includes('secret'));
const r = M.fromFile(f, L, 'deck');
assert.strictEqual(r.layout.spaces[0].pages.length, 3);
const added = r.layout.spaces[0].pages.find((p) => p.id === r.pageId);
assert.ok(added && added.tiles.length === L.spaces[0].pages[0].tiles.length);
const ids = new Set();
for (const s of r.layout.spaces) for (const p of s.pages || []) for (const t of p.tiles) { assert.ok(!ids.has(t.id), 'ids stay unique'); ids.add(t.id); }
// The whole Deck: its look comes with it, this computer's window space stays.
const d = M.deckFile({ ...L, look: M.LOOKS.glass });
assert.ok(d.layout.spaces.every((s) => s.kind === 'tiles'));
const back = M.fromFile(d, L);
assert.deepStrictEqual(back.layout.look, M.LOOKS.glass);
assert.ok(back.layout.spaces.some((s) => s.kind === 'windows'));
assert.throws(() => M.fromFile({ hello: 1 }, L), /Not a TwinDesk Deck file/);
// The new widgets keep their options; a GitHub link becomes owner/name.
assert.deepStrictEqual(M.action({ k: 'widget', what: 'build', repo: 'https://github.com/InukaAsith/TwinDesk.git', branch: ' main ' }), { k: 'widget', what: 'build', repo: 'InukaAsith/TwinDesk', branch: 'main' });
assert.strictEqual(M.action({ k: 'widget', what: 'build', repo: 'not a repo' }).repo, '');
assert.deepStrictEqual(M.action({ k: 'widget', what: 'agents', tool: 'gemini' }), { k: 'widget', what: 'agents', tool: '' });
assert.deepStrictEqual(M.action({ k: 'widget', what: 'quota', tool: 'codex' }), { k: 'widget', what: 'quota', tool: 'codex' });
assert.strictEqual(M.symbolOf({ k: 'widget', what: 'mixer' }), 'sliders');
for (const n of M.TEMPLATES) for (const tl of M.template(n).tiles) assert.ok(!tl.icon || M.SYMBOLS.includes(tl.icon), `${n}: ${tl.icon} is a symbol`);
// The media page: a mixer where the computer has one, buttons where it hasn't.
assert.ok(M.template('media').tiles.some((x) => x.action.what === 'mixer'));
assert.ok(!M.template('media', 'landscape', { mixer: false }).tiles.some((x) => x.action.what === 'mixer'));
assert.deepStrictEqual(M.widgets(M.normalize({ spaces: [{ kind: 'tiles', pages: [M.template('dev')] }] })).map((w) => w.what).sort(), ['agents', 'build', 'cpu', 'quota']);
// The agents' logs (shared/deck-agents.js).
const A = require('../deck-agents.js');
const j = (o) => JSON.stringify(o);
const now = Date.now();
const working = A.claudeSession([
j({ type: 'user', cwd: '/w/TwinDesk', gitBranch: 'deck', message: { role: 'user', content: 'Add the agents widget' }, timestamp: new Date(now - 5000).toISOString() }),
j({ type: 'assistant', message: { role: 'assistant', content: [{ type: 'tool_use', name: 'Bash' }], stop_reason: 'tool_use' }, timestamp: new Date(now - 4000).toISOString() }),
], now - 1000);
assert.deepStrictEqual([working.project, working.branch, working.title, working.state], ['TwinDesk', 'deck', 'Add the agents widget', 'working']);
const done = A.claudeSession([
j({ type: 'assistant', cwd: '/w/app', message: { role: 'assistant', content: [{ type: 'text', text: 'Done.' }], stop_reason: 'end_turn' } }),
], now - 60 * 60e3);
assert.strictEqual(done.state, 'waiting');
const limited = A.claudeSession([j({ type: 'assistant', cwd: '/w/app', timestamp: new Date(now).toISOString(), message: { content: [{ type: 'text', text: `Claude AI usage limit reached|${Math.floor(now / 1000) + 3600}` }] } })], now);
assert.ok(limited.limit && limited.limit.resets > now);
// The five-hour window starts at the hour of its first message; a message after it ends starts another.
const h = 3600e3;
const base = Math.floor(now / h) * h;
assert.strictEqual(A.claudeWindow([base - 7 * h + 60e3, base - h + 120e3, base - h + 600e3]), base - h);
assert.strictEqual(A.claudeWindow([base - 9 * h]), 0);
const cx = A.codexSession([j({ type: 'session_meta', payload: { cwd: '/w/api' } })], [
j({ type: 'event_msg', payload: { type: 'user_message', message: 'Fix the tests' } }),
j({ type: 'event_msg', payload: { type: 'task_started' } }),
j({ type: 'event_msg', timestamp: new Date(now).toISOString(), payload: { type: 'token_count', rate_limits: { primary: { used_percent: 42, window_minutes: 300, resets_in_seconds: 1800 }, secondary: { used_percent: 10, window_minutes: 10080, resets_in_seconds: 86400 } } } }),
j({ type: 'event_msg', payload: { type: 'task_complete' } }),
], now);
assert.deepStrictEqual([cx.project, cx.title, cx.state], ['api', 'Fix the tests', 'waiting']);
const u = A.codexUsage(cx.limits, cx.limitsAt);
assert.deepStrictEqual(u.map((x) => [x.label, x.used]), [['5-hour', 0.42], ['Weekly', 0.1]]);
assert.ok(u[0].left > 1700e3 && u[0].left <= 1800e3);
console.log('deck-look: ok');