One keyboard and mouse for a Mac and a Windows PC over the local network, in either direction.
Beamer 1.4.4
Toby Kalkman2a351e1c9a09
diff --git a/VERSION b/VERSIONindex 428b770..1c99cf0 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-1.4.3+1.4.4diff --git a/mac_app/kvm_bridge_app.py b/mac_app/kvm_bridge_app.pyindex 1c44900..6dd0e4d 100644--- a/mac_app/kvm_bridge_app.py+++ b/mac_app/kvm_bridge_app.py@@ -3326,6 +3326,17 @@ def parse_args(argv=None):return parser.parse_args(argv)+def stay_awake(process_info=None):+ """An activity that keeps macOS from napping Beamer or coalescing its timers, which made its+ links answer seconds late and drop (test_app_nap.py); idle system sleep is still allowed. The+ token returned must be kept for as long as Beamer runs."""+ process_info = process_info or AppKit.NSProcessInfo.processInfo()+ return process_info.beginActivityWithOptions_reason_(+ AppKit.NSActivityUserInitiatedAllowingIdleSystemSleep | AppKit.NSActivityLatencyCritical,+ "Beamer's links answer the other machines within two seconds",+ )++def main(argv=None):args = parse_args(argv)if sys.platform != "darwin":@@ -3350,6 +3361,7 @@ def main(argv=None):cfg = editable_default_config()controller = WakingController(cfg, logger=logger)app = TrayApp(controller, settings_store, logger, hidden=args.hidden)+ awake = stay_awake() # noqa: F841 (held until Beamer quits)controller.start()try:app.run()diff --git a/mac_app/tests/test_app_nap.py b/mac_app/tests/test_app_nap.pynew file mode 100644index 0000000..4ab8fb3--- /dev/null+++ b/mac_app/tests/test_app_nap.py@@ -0,0 +1,50 @@+"""The Mac app is never napped.++On 01-10-2026 macOS napped Beamer from 12:20:18 to 12:43:37 (runningboardd: "Set AppNap state ...+socket:Y cpu:Y timer:Tier5"), and in that window its links to the PC dropped 42 times: a napped+process sends its pings and acks seconds late, and the far side gives each link up after two. A+machine that may be taken at any moment by another holds an activity for as long as it runs."""++import os+import sys+import unittest++sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))++import AppKit++import kvm_bridge_app+++class FakeProcessInfo:+ def __init__(self):+ self.begun = []++ def beginActivityWithOptions_reason_(self, options, reason):+ self.begun.append((options, reason))+ return "token"+++class AppNapTests(unittest.TestCase):+ def test_beamer_holds_an_activity_that_is_neither_napped_nor_coalesced(self):+ info = FakeProcessInfo()+ token = kvm_bridge_app.stay_awake(info)+ self.assertEqual(token, "token")+ (options, reason), = info.begun+ self.assertEqual(options & AppKit.NSActivityUserInitiatedAllowingIdleSystemSleep,+ AppKit.NSActivityUserInitiatedAllowingIdleSystemSleep)+ self.assertEqual(options & AppKit.NSActivityLatencyCritical, AppKit.NSActivityLatencyCritical)+ self.assertTrue(reason)++ def test_it_lets_the_machine_sleep_when_idle(self):+ info = FakeProcessInfo()+ kvm_bridge_app.stay_awake(info)+ options = info.begun[0][0]+ self.assertFalse(options & AppKit.NSActivityIdleSystemSleepDisabled)++ def test_the_real_activity_is_taken(self):+ self.assertIsNotNone(kvm_bridge_app.stay_awake())+++if __name__ == "__main__":+ unittest.main()