From bb1cc805c1c7798c618183016d9eff0b3a32e483 Mon Sep 17 00:00:00 2001 From: Jon Kinney Date: Mon, 27 Apr 2026 12:59:53 -0500 Subject: [PATCH] macos: opt out of App Nap via NSAppSleepDisabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit LSUIElement processes are prime App Nap candidates when idle, and once App-Napped macOS throttles user-space timers. The ping_pong keepalive loop in src/connect.rs uses tokio sleeps with a 2 s ping cycle; if those sleeps slip past the peer's 1 s grace the peer's watchdog tears down the DTLS connection and the daemon reconnects from a fresh ephemeral port on the next event — the "silence-then-new-source-port" pattern visible in the peer's logs after long idle. Setting NSAppSleepDisabled keeps the timers running on schedule across long idle windows. No code-side changes; the key is honored by macOS for the lifetime of the process. Co-Authored-By: Claude Opus 4.7 (1M context) --- build-aux/macos-lsui-element.plist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build-aux/macos-lsui-element.plist b/build-aux/macos-lsui-element.plist index 4a60be7..5ac2193 100644 --- a/build-aux/macos-lsui-element.plist +++ b/build-aux/macos-lsui-element.plist @@ -1,5 +1,7 @@ LSUIElement + NSAppSleepDisabled + NSInputMonitoringUsageDescription Lan Mouse needs Input Monitoring access to capture keyboard and mouse input and forward it to remote machines on your network. NSAppleEventsUsageDescription