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.
// Keyboard › Modifier keys (shared/modmap.js): how each modifier key this computer receives lands
// here. A switch (off by default: exactly as before) and one row per key, "As it is" or another key.
// One-to-one only for now; Multi-device pages don't show it.
// const card = UI.modMapCard(); body.append(card.el); card.update(state)
'use strict';
UI.modMapCard = () => {
const t = (...a) => (typeof I18n === 'undefined' ? a[0] : I18n.t(...a));
const { api } = UI;
const mac = /Mac/.test(navigator.platform || navigator.userAgent);
const NAMES = {
ControlLeft: t('Left Ctrl'), ControlRight: t('Right Ctrl'),
MetaLeft: t('Left Command or Windows'), MetaRight: t('Right Command or Windows'),
AltLeft: t('Left Option or Alt'), AltRight: t('Right Option or Alt'),
ShiftLeft: t('Left Shift'), ShiftRight: t('Right Shift'),
};
const CODES = Object.keys(NAMES);
let cur = { on: false, keys: {} };
const save = (p) => {
cur = { on: 'on' in p ? p.on : cur.on, keys: p.keys || cur.keys };
api.setKeys({ modMap: cur });
};
const sw = UI.switch((v) => save({ on: v }), { label: t('Map modifier keys') });
const onRow = UI.row(t('Map modifier keys'), '', [sw]);
const rows = CODES.map((code) => {
const sel = UI.select([{ value: '', label: t('As it is') }, ...CODES.filter((c) => c !== code).map((c) => ({ value: c, label: NAMES[c] }))], (v) => {
const keys = { ...cur.keys };
if (v) keys[code] = v; else delete keys[code];
save({ keys });
});
const row = UI.row(NAMES[code], '', [sel.el || sel]);
return { code, sel, row };
});
const card = UI.card(t('Modifier keys'), [onRow, ...rows.map((r) => r.row)], { cls: 'keep-on' }); // set before connecting too
const mesh = typeof location !== 'undefined' && /\/mesh\//.test(location.pathname);
return {
el: card,
update(s) {
card.hidden = mesh;
if (mesh) return;
const m = (s.keys && s.keys.modMap) || { on: false, keys: {} };
cur = { on: !!m.on, keys: { ...(m.keys || {}) } };
sw.set(cur.on);
onRow.setHint(cur.on
? t('Keys from the other computer, as they land here. A key not set stays as it is, Swap Ctrl and Command included')
: (mac ? t('Off: keys from a PC land as they are, apart from Swap Ctrl and Command') : t('Off: keys from the other computer land as they are, apart from Swap Ctrl and Command')));
for (const r of rows) {
r.row.hidden = !cur.on;
r.sel.set(cur.keys[r.code] || '');
}
},
};
};