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.
// General tab: permissions, app behaviour.
'use strict';
UI.tab({
id: 'general',
order: 100,
title: I18n.t('General'),
desc: '',
color: 'linear-gradient(#aeaeb2, #636366)',
bottom: true,
badge: (s) => {
const p = s.permissions;
if (p && (p.screen !== 'granted' || !p.accessibility || p.inputMonitoring === false)) return '!';
return '';
},
build(body) {
const { el, api } = UI;
const t = (...args) => I18n.t(...args);
const language = UI.select([
{ value: 'en', label: '🇬🇧 English' }, { value: 'zh-CN', label: '🇨🇳 简体中文' }, { value: 'ru', label: '🇷🇺 Русский' }, { value: 'tr', label: '🇹🇷 Türkçe' }, { value: 'pt-BR', label: '🇧🇷 Português (Brasil)' }, { value: 'de', label: '🇩🇪 Deutsch' }, { value: 'es', label: '🇪🇸 Español' },
], (v) => api.setLanguage(v));
language.set(I18n.locale);
const PERMS = [
{ kind: 'screen', label: t('Screen Recording'), note: t('To share your screen') },
{ kind: 'accessibility', label: t('mac.accessibility'), note: t('So the other computer can control this one') },
{ kind: 'inputMonitoring', label: t('Input Monitoring'), note: t('To use this keyboard on the other computer') },
// Every other permission a feature uses, in one place (each is asked for when the feature is used).
{ kind: 'localNetwork', label: t('Local Network'), note: t('To find your other computers and phones'), state: (s) => (s.discovery ? s.discovery.localNetwork !== false : null) },
{ kind: 'bluetooth', label: t('Bluetooth'), note: t('For a phone or computer that isn’t on this network'), state: (s) => (s.net && s.net.radio ? s.net.radio !== 'denied' && s.net.radio !== 'unauthorized' : null) },
{ kind: 'location', label: t('Location'), note: t('To join a phone’s or PC’s Wi-Fi Direct (macOS shows Wi-Fi networks only with it)'), state: () => null },
{ kind: 'fullDisk', label: t('Full Disk Access'), note: t('Optional: to share any folder with the other computer'), state: () => null },
];
const perms = PERMS.map((p) => {
const pill = el('span', { class: 'pill' });
let request = false;
const button = UI.button(t('Open'), () => request ? api.allowPermission(p.kind) : api.openSettings(p.kind), 'small');
const row = UI.row(p.label, p.note, [pill, button]);
return { p, pill, row, button, setRequest: (v) => { request = v; } };
});
const helperRow = UI.row(t('Background helper'), '');
const helperVal = el('span', { class: 'value' });
helperRow.querySelector('.controls').append(helperVal);
const deviceName = el('span', { class: 'value', attrs: { 'data-literal': '' } });
const deviceRow = UI.row(t('Computer name'), t('How other computers see this one'), [deviceName]);
const loginSw = UI.switch((v) => api.setApp({ openAtLogin: v }), { label: t('Open at login') });
// Off, While connected, or Always: connected or not, for a computer on its own (settings.app.keepAwake, keepAwakeAlways)
const awakeSeg = UI.segmented([
{ value: 'off', label: t('Off') }, { value: 'connected', label: t('While connected') }, { value: 'always', label: t('Always') },
], (v) => api.setApp({ keepAwake: v !== 'off', keepAwakeAlways: v === 'always' })); // #240, shared/keepawake.js
const proximityLockLabel = t('Lock Mac when the phone disconnects');
const proximityLockSw = UI.switch((v) => api.setProximityLock(v), { label: proximityLockLabel });
const lockSw = UI.switch((v) => api.setApp({ lockTogether: v }), { label: t('Lock together') }); // #322, shared/locksync.js
const hudSw = UI.switch((v) => api.setApp({ hud: v }), { label: t('Show a popup when switching') });
// Wake this Mac from the other computer; the Share menu entry.
const wakeSw = UI.switch((v) => api.setWakeOnLan(v), { label: t('Wake from the network') });
const wakeRow = UI.row(t('Let {name} wake {me}'), '', [wakeSw]);
// Bluetooth when not on the same network: with phones (on unless switched off), with computers (off unless switched on).
const bleSw = UI.switch((v) => api.setNet({ ble: v }), { label: t('Bluetooth with phones') });
const bleRow = UI.row(t('Bluetooth with phones'), '', [bleSw]);
const blePcSw = UI.switch((v) => api.setNet({ blePc: v }), { label: t('Bluetooth with computers') });
const blePcRow = UI.row(t('Bluetooth with computers'), '', [blePcSw]);
// Bluetooth off altogether while the session is on the same Wi-Fi (blepolicy.js wifiQuiet).
// Tailscale (#161, shared/tailnet.js): reaching a paired device away from its network.
const relayCard = UI.relayCard ? UI.relayCard() : null; // General › Your own relay
const tailSw = UI.switch((v) => api.setNet({ tailscale: v }), { label: t('Connect through Tailscale') });
const tailRow = UI.row(t('Connect through Tailscale'), '', [tailSw]);
const tailHere = UI.row(t('This computer on Tailscale'), '', []);
const tailHow = UI.row(t('How to set it up'), t('To connect away from home, also from a phone on mobile data: install Tailscale on both devices and sign in to the same account. Pair them once on the same network, or with Connect by address and the other one’s Tailscale address (100.x.y.z). Afterwards, while Tailscale is on, TwinDesk reconnects through it when the other device isn’t on this network.'), []);
// Network fallback (shared/netlink.js, off by default; one-to-one): a Wi-Fi link when the network drops.
const fallbackSw = UI.switch((v) => api.setNet({ fallback: v }), { label: t('Network fallback') });
const fallbackRow = UI.row(t('Network fallback'), '', [fallbackSw]);
const bleWifiSw = UI.switch((v) => api.setNet({ bleWifiOff: v }), { label: t('Turn off Bluetooth on Wi-Fi connections') });
const bleWifiRow = UI.row(t('Turn off Bluetooth on Wi-Fi connections'), '', [bleWifiSw]);
const shareRow = UI.row(t('TwinDesk in the Share menu'), t('Share › TwinDesk sends files to the other computer'),
[UI.button(t('Extensions…'), () => api.openSettings('extensions'), 'small')]);
const media = UI.mediaControlsRow(); // a phone's media controls on the Phone page (shared/ui-nowplaying.js)
// Appearance: the phone's wallpaper (settings.phone.wallpaper, was on the Phone page).
const wallSw = UI.switch((v) => api.setPhone({ wallpaper: v }), { label: t('Show the phone’s wallpaper') });
const wallRow = UI.row(t('Show the phone’s wallpaper'), t('On its tile and Overview. TwinDesk on the phone reads it once wireless debugging is set up'), [wallSw]);
// Overview: what it shows (settings.ui.overview).
const parts = [['media', t('Now playing'), t('What plays on the phone, with its controls')], ['qs', t('Quick actions'), t('Wi-Fi, Bluetooth, torch, Do not disturb and more, with volume and ringer')],
['notifs', t('Latest notifications'), t('The newest few, with Copy for one-time codes')], ['apps', t('Most used apps'), t('The phone’s most used apps this week')],
['clipboard', t('Clipboard'), t('Its recent items, while Clipboard is on')], ['files', t('Send files'), t('A drop zone that sends files to the device')]];
const partSw = {};
const partRows = parts.map(([k, label, hint]) => {
partSw[k] = UI.switch((v) => api.setOverview({ [k]: v }), { label });
return UI.row(label, hint, [partSw[k]]);
});
// Theme and accent colour (shared/look.js, shared/ui-look.js).
const styleRow = UI.styleRow((v) => api.setLook({ style: v })); // Glass or Simple (shared/ui-glass.css)
const themeRow = UI.themeRow((v) => api.setLook({ theme: v }));
const accentRow = UI.accentRow((v) => api.setLook({ accent: v }));
// One page that scrolls, its sections listed beside it; Permissions first.
// Advanced: how input travels (shared/inputlane.js). UDP (tdv2, the default): moves on their own
// lane beside the session. TCP (tdv1): everything on the session. Read at startup, so Restart shows.
let protoStart = null; // the protocol this run started with
const protoRestart = UI.button(t('Restart'), () => api.relaunch(), 'small');
protoRestart.hidden = true;
const protoSel = UI.select([
{ value: 'udp', label: t('UDP (tdv2)') }, { value: 'tcp', label: t('TCP (tdv1)') },
], (v) => { api.setApp({ inputProtocol: v }); protoRestart.hidden = v === protoStart; });
const protoRow = UI.row(t('Input protocol'), t('UDP moves the pointer faster. TCP works on networks that block UDP. Applies after a restart'), [protoSel, protoRestart]);
// Prioritize performance over battery life (settings.app.keepPinging, shared/quiet.js, #143): off, a
// session nothing uses stops pinging every second so a phone or laptop can sleep; on, as before.
const pingSw = UI.switch((v) => api.setApp({ keepPinging: v }), { label: t('Prioritize performance over battery life') });
const pingRow = UI.row(t('Prioritize performance over battery life'), t('Checks the connection every second, even when nothing is in use. Off: an idle connection is checked every few minutes, and at once when something starts, so phones and laptops can sleep'), [pingSw]);
// Local API (shared/localapi.js): the person's own scripts on this computer.
const apiSw = UI.switch((v) => api.setApp({ localApi: v }), { label: t('Local API') });
const apiRow = UI.row(t('Local API'), '', [apiSw], { literalHint: true });
// Task alerts: twindesk-notify (bin/ in TwinDesk's folder) runs a command and tells the phone when it ends (shared/task-alerts.js)
let notifyCmd = '';
const notifyRow = UI.row(t('Task alerts'), '', [UI.button(t('Copy'), () => notifyCmd && api.copyText(notifyCmd), 'small')], { literalHint: true });
notifyRow.hidden = true;
const engines = UI.enginesRows(); // Engines in use, while connected (shared/ui-engines.js)
const modules = UI.modulesCard ? UI.modulesCard() : { card: null, update() {} }; // General › Modules (shared/ui-modules.js; not in Multi-device)
// Debug (shared/ui-debug.js, Multi-device): its page opens from here instead of the sidebar.
const debugBtn = UI.button(t('Open'), () => UI.go('debug'), 'small');
const debugPill = el('span', { class: 'pill good', text: t('On') });
debugPill.hidden = true;
const debugCard = UI.card(t('Debug'), [UI.row(t('Debug'), t('Status, logs, screenshots and diagnostics of any device'), [debugPill, debugBtn])]);
debugCard.hidden = true;
const sections = UI.sections([
UI.card(t('Permissions'), [
...perms.map((x) => x.row),
UI.row(t('Changed a permission?'), t('Restart to apply it'), [UI.button(t('Restart'), () => api.relaunch(), 'small')]),
]),
UI.card(t('Startup'), [
UI.row(t('Open at login'), '', [loginSw]),
UI.row(t('Keep the display awake'), '', [awakeSeg.el]),
UI.row(t('Lock together'), t('This computer locks when another connected computer locks, and the other way round. On each computer'), [lockSw]),
]),
UI.card(t('Security'), [
UI.row(proximityLockLabel, t('If the last connected paired phone drops unexpectedly, you have 15 seconds to cancel before this Mac locks.'), [proximityLockSw]),
]),
UI.card(t('Appearance'), [
styleRow,
themeRow,
accentRow,
UI.arrangeRow ? UI.arrangeRow() : null,
UI.row(t('Show a popup when switching'), t('When the mouse and keyboard move between devices'), [hudSw]),
wallRow,
media.el,
]),
UI.card(t('Language'), [
UI.row(t('Language'), t('Changing the language restarts TwinDesk.'), [language]),
]),
UI.card(t('Tutorial'), [
UI.row(t('Tour of TwinDesk'), t('How to install TwinDesk on your other device, connect it, and what each page does.'), [UI.button(t('Show the tour'), () => window.Tour && Tour.start(), 'small')]),
UI.row(t('What’s new'), t('What came in this version.'), [UI.button(t('Show'), () => window.Tour && Tour.news(), 'small')]),
]),
UI.card(t('Overview'), partRows),
UI.card(t('Network and Bluetooth'), [bleRow, blePcRow, bleWifiRow, fallbackRow, wakeRow, shareRow]),
UI.card(t('Tailscale'), [tailRow, tailHere, tailHow]),
...(relayCard ? [relayCard.el] : []), // your own relay (shared/ui-relay.js)
UI.card(t('This computer'), [deviceRow, helperRow]),
UI.card(t('Connections'), [pingRow, apiRow, notifyRow]),
...(modules.card ? [modules.card] : []),
UI.card(t('Advanced'), [protoRow, ...engines.rows]),
debugCard,
]);
body.append(sections);
return (s) => {
debugCard.hidden = !(UI.tabs || []).some((d) => d.id === 'debug'); // the Debug module, in Multi-device
debugPill.hidden = !(s.debug && s.debug.debuggedBy && s.debug.debuggedBy.length); // someone debugging this computer now
if (s.app) {
const proto = s.app.inputProtocol === 'tcp' ? 'tcp' : 'udp';
if (protoStart === null) protoStart = proto;
protoSel.set(proto);
protoRestart.hidden = proto === protoStart;
}
styleRow.render(s.look && s.look.style);
themeRow.render(s.look && s.look.theme);
accentRow.render(s.look);
sections.spy();
media.update(s);
engines.update(s);
modules.update(s);
wallSw.set(!s.phone || !s.phone.settings || s.phone.settings.wallpaper !== false);
const ov = (s.ui && s.ui.overview) || {};
for (const k of Object.keys(partSw)) partSw[k].set(ov[k] !== false);
for (const { p, pill, button, setRequest } of perms) {
const v = p.state ? p.state(s) : s.permissions[p.kind];
const ok = p.kind === 'screen' ? v === 'granted' : v === true;
const unknown = v === null || v === undefined || v === 'unknown';
const request = !ok && ['screen', 'accessibility', 'inputMonitoring'].includes(p.kind);
setRequest(request);
button.textContent = t(request ? 'Allow' : 'Open');
pill.className = `pill ${unknown ? 'muted' : ok ? 'good' : 'bad'}`;
// macOS counts Accessibility as enough for TwinDesk's keyboard tap: Input Monitoring reads
// as allowed then, with its own switch in System Settings still off (that's fine).
const viaAx = p.kind === 'inputMonitoring' && ok && s.permissions.accessibility === true;
pill.hidden = unknown && !!p.state; // macOS doesn't tell: Open shows it
pill.textContent = unknown ? t('Unknown') : viaAx ? t('Allowed by Accessibility') : ok ? t('Allowed') : t('Not allowed');
}
if (s.app) {
loginSw.set(s.app.openAtLogin);
awakeSeg.set(s.app.keepAwake === false ? 'off' : s.app.keepAwakeAlways === true ? 'always' : 'connected');
proximityLockSw.set(s.app.proximityLock === true);
lockSw.set(s.app.lockTogether === true);
hudSw.set(s.app.hud !== false);
pingSw.set(s.app.keepPinging === true);
apiRow.hidden = !s.localApi;
notifyCmd = s.localApi && s.localApi.on && s.localApi.notify ? (/\s/.test(s.localApi.notify) ? `"${s.localApi.notify}"` : s.localApi.notify) : '';
notifyRow.hidden = !notifyCmd;
if (notifyCmd) notifyRow.setHint(t('Put {cmd} before a command in a terminal, and the phone tells you when it ends. Turn on Task alerts in the phone’s Notifications', { cmd: notifyCmd }));
if (s.localApi) {
apiSw.set(!!s.localApi.on);
apiRow.setHint(s.localApi.on ? t('For your own scripts here: its address and key are in {file}, and the key changes each time it starts', { file: s.localApi.file }) : t('Lets your own scripts on this computer send files and set the clipboard. Nothing from a browser'));
}
}
const w = s.wake || {};
wakeSw.set(w.womp === true);
wakeSw.disable(w.womp == null);
wakeRow.setHint(w.womp == null ? t('Checking…') : t('Wake for network access. Asks for your password to change it'));
if (s.net) {
bleSw.set(s.net.ble);
blePcSw.set(s.net.blePc === true);
bleWifiSw.set(s.net.bleWifiOff !== false);
fallbackRow.hidden = typeof location !== 'undefined' && /\/mesh\//.test(location.pathname); // one-to-one for now
fallbackSw.set(s.net.fallback === true);
fallbackRow.setHint(s.net.fallback === true ? t('When the Wi-Fi drops, the phone makes a Wi-Fi Direct link and this computer joins it, so screens, sound and files go on. Back on the usual Wi-Fi when the phone sees it again')
: t('Off: when the Wi-Fi drops, the session goes on through Bluetooth only'));
tailSw.set(s.net.tailscale !== false);
tailRow.setHint(s.net.tailscale === false ? t('Off: only this network, Bluetooth and the cable') : t('When the other device isn’t on this network, TwinDesk tries its Tailscale address'));
tailHere.setHint((s.net.tailnet || []).length ? s.net.tailnet.join(', ') : t('Not on Tailscale now'));
if (relayCard) relayCard.update(s.net.relay);
bleWifiRow.setHint(s.net.bleWifiOff === false ? t('Bluetooth stays on beside the Wi-Fi, the way back if it drops')
: s.net.bleOff ? t('Off now: the session is on the same Wi-Fi. Bluetooth comes back when it ends')
: t('On the same Wi-Fi network (not Wi-Fi Direct), Bluetooth goes off until the session ends. With a computer, phones can’t find this one meanwhile'));
const RADIO = { off: t('Bluetooth is off'), unauthorized: t('Allow TwinDesk in System Settings › Privacy & Security › Bluetooth'), unsupported: t('This Mac can’t advertise over Bluetooth') };
bleRow.setHint(!s.net.ble ? t('Only phones on this network or a USB cable connect')
: RADIO[s.net.radio] || t('Phones nearby connect over Bluetooth. Files and screens move to a direct Wi-Fi link for a while'));
blePcRow.setHint(s.net.blePc !== true ? t('Only computers on this network connect')
: RADIO[s.net.radio] || t('PCs nearby connect over Bluetooth. Files and screens move to a direct Wi-Fi link for a while'));
}
helperVal.textContent = s.helper && s.helper.running ? t('Running') : t('Not running');
deviceName.textContent = s.macName || '';
};
},
});