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.
// Pending lane moves from the UDP thread: a fixed-capacity ring. When the UI thread drains, every
// slot still queued is summed into one delta (as mac-helper's Lane.swift), so injection keeps up with
// high-rate move streams.
using System;
namespace MacShare
{
sealed class LaneMoveRing
{
public const int Capacity = 1024;
readonly double[] ring = new double[Capacity * 2];
readonly object gate = new object();
int head, tail;
public void Enqueue(double dx, double dy)
{
lock (gate)
{
if (head - tail < Capacity)
{
int i = (head % Capacity) * 2;
ring[i] = dx;
ring[i + 1] = dy;
head++;
}
else // full (the UI thread is stuck): add to the newest, nothing is lost
{
int i = ((head - 1) % Capacity) * 2;
ring[i] += dx;
ring[i + 1] += dy;
}
}
}
// One coalesced delta for everything still in the ring; false when empty.
public bool TryDrainCoalesced(out double dx, out double dy)
{
lock (gate)
{
if (tail == head)
{
dx = dy = 0;
return false;
}
dx = dy = 0;
while (tail != head)
{
int i = (tail % Capacity) * 2;
dx += ring[i];
dy += ring[i + 1];
tail++;
}
return dx != 0 || dy != 0;
}
}
public int Queued
{
get { lock (gate) return head - tail; }
}
public void Reset()
{
lock (gate)
{
head = tail = 0;
}
}
}
}