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 crossing animation on Linux (X11), as Windows' (windows-helper/src/Flash.cs): where the pointer
// leaves or arrives, a soft accent glow along the edge and a ring at the pointer that closes in when
// leaving and spreads out when arriving. One click-through, transparent window around the spot, made
// at the first crossing and let go after a minute without one; nothing runs before that.
// X11 only: Wayland doesn't let an app place a window. Skipped when the desktop's animations are off
// (GNOME, Cinnamon, MATE, Budgie: org.gnome.desktop.interface enable-animations) or no compositor
// draws transparent windows (they'd show as a black square; the helper says, `ready` composited).
// const flash = require('./edgeflash'); flash.play({ side, leaving, composited, at? })
'use strict';
const path = require('path');
const { execFile } = require('child_process');
const SIZE = 420; // the window, in DIP: the ring and the glow's middle part fit in it
const IDLE_MS = 60000;
let win = null;
let idle = null;
let hideTimer = null;
let allowed = null; // null until read: animations on and a compositor running
function x11() {
return process.platform === 'linux' && !process.env.WAYLAND_DISPLAY && process.env.XDG_SESSION_TYPE !== 'wayland';
}
// Once per run: the desktop's animations switch.
function check() {
if (allowed !== null) return Promise.resolve(allowed);
return new Promise((resolve) => execFile('gsettings', ['get', 'org.gnome.desktop.interface', 'enable-animations'], { timeout: 1500 }, (err, out) => {
allowed = err ? true : String(out).trim() !== 'false';
resolve(allowed);
}));
}
function window() {
const { BrowserWindow } = require('electron');
if (win && !win.isDestroyed()) return win;
win = new BrowserWindow({
width: SIZE, height: SIZE, show: false, frame: false, transparent: true, backgroundColor: '#00000000', hasShadow: false,
resizable: false, movable: false, minimizable: false, maximizable: false, fullscreenable: false, focusable: false,
skipTaskbar: true, alwaysOnTop: true, type: 'notification', title: 'TwinDesk',
webPreferences: { contextIsolation: true, nodeIntegration: false, sandbox: true, backgroundThrottling: false },
});
win.setIgnoreMouseEvents(true);
win.setAlwaysOnTop(true, 'screen-saver');
win.loadFile(path.join(__dirname, 'edgeflash.html'));
win.on('closed', () => { win = null; });
return win;
}
// side: 'left' | 'right' | 'top' | 'bottom' | null (no edge: the ring alone); leaving: true when the
// pointer goes to the other device. at: {x, y} in DIP, else where the pointer is now.
async function play({ side = null, leaving = false, at = null, accent = '', composited = false } = {}) {
if (!x11() || !composited) return;
if (!(await check())) return;
const { screen, systemPreferences } = require('electron');
const p = at || screen.getCursorScreenPoint();
const d = screen.getDisplayNearestPoint(p).bounds;
// The window sits around the pointer, pushed inside the display; the page draws relative to it.
const x = Math.round(Math.max(d.x, Math.min(d.x + d.width - SIZE, p.x - SIZE / 2)));
const y = Math.round(Math.max(d.y, Math.min(d.y + d.height - SIZE, p.y - SIZE / 2)));
let color = accent;
try { if (!color && systemPreferences.getAccentColor) color = '#' + systemPreferences.getAccentColor().slice(0, 6); } catch (_) { /* none on this desktop */ }
const w = window();
w.setBounds({ x, y, width: SIZE, height: SIZE });
const args = { px: p.x - x, py: p.y - y, side, leaving: !!leaving, color: /^#[0-9a-f]{6}$/i.test(color || '') ? color : '#3584e4' };
const go = () => {
if (w.isDestroyed()) return;
w.webContents.executeJavaScript(`window.play && window.play(${JSON.stringify(args)})`).catch(() => {});
w.showInactive();
clearTimeout(hideTimer);
hideTimer = setTimeout(() => { if (!w.isDestroyed()) w.hide(); }, 800);
};
if (w.webContents.isLoading()) w.webContents.once('did-finish-load', go); else go();
clearTimeout(idle);
idle = setTimeout(() => { if (win && !win.isDestroyed()) win.destroy(); win = null; }, IDLE_MS);
if (idle.unref) idle.unref();
}
module.exports = { play };