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.
// Keep the pointer here while an app is fullscreen (kvmConfig stayFullscreen, #373): a game, a
// video or a presentation in front doesn't lose the pointer at the screen's edge. Checked only when
// the pointer is about to leave (EdgeAllowed), never in a loop. The shortcut and the hotkey still
// switch. Windows' own answer (SHQueryUserNotificationState: Direct3D fullscreen, presentation
// mode, a fullscreen app) and, for borderless fullscreen games Windows doesn't flag, a front window
// that covers its whole monitor (not the desktop or the taskbar).
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace MacShare
{
static class FullscreenGuard
{
[DllImport("shell32.dll")] static extern int SHQueryUserNotificationState(out int state);
[DllImport("user32.dll")] static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll")] static extern bool GetWindowRect(IntPtr h, out RECT r);
[DllImport("user32.dll")] static extern IntPtr MonitorFromWindow(IntPtr h, uint flags);
[DllImport("user32.dll")] static extern bool GetMonitorInfo(IntPtr m, ref MONITORINFO info);
[DllImport("user32.dll", CharSet = CharSet.Unicode)] static extern int GetClassName(IntPtr h, StringBuilder s, int max);
[DllImport("user32.dll")] static extern IntPtr GetAncestor(IntPtr h, uint flags);
[StructLayout(LayoutKind.Sequential)] struct RECT { public int left, top, right, bottom; }
[StructLayout(LayoutKind.Sequential)] struct MONITORINFO { public int cbSize; public RECT monitor, work; public uint flags; }
const int QUNS_BUSY = 2, QUNS_RUNNING_D3D_FULL_SCREEN = 3, QUNS_PRESENTATION_MODE = 4;
public static bool Active()
{
try
{
int s;
if (SHQueryUserNotificationState(out s) == 0 && (s == QUNS_BUSY || s == QUNS_RUNNING_D3D_FULL_SCREEN || s == QUNS_PRESENTATION_MODE)) return true;
IntPtr fg = GetAncestor(GetForegroundWindow(), 2); // GA_ROOT
if (fg == IntPtr.Zero) return false;
var cls = new StringBuilder(64);
GetClassName(fg, cls, cls.Capacity);
string c = cls.ToString();
if (c == "Progman" || c == "WorkerW" || c == "Shell_TrayWnd" || c == "Shell_SecondaryTrayWnd") return false; // the desktop, the taskbar
RECT r;
if (!GetWindowRect(fg, out r)) return false;
var mi = new MONITORINFO { cbSize = Marshal.SizeOf(typeof(MONITORINFO)) };
if (!GetMonitorInfo(MonitorFromWindow(fg, 2 /* MONITOR_DEFAULTTONEAREST */), ref mi)) return false;
return r.left <= mi.monitor.left && r.top <= mi.monitor.top && r.right >= mi.monitor.right && r.bottom >= mi.monitor.bottom;
}
catch { return false; }
}
}
}