Fix macOS input permissions, Caps Lock, scroll and layout-independent typing, reconnect the X11 injector, and release VNC resources when start fails

This commit is contained in:
Viktor Liu
2026-09-23 08:07:11 +02:00
parent 9b0a3d3b29
commit ff4d6928f7
4 changed files with 250 additions and 51 deletions
+13 -9
View File
@@ -13,18 +13,22 @@ import (
func newPlatformVNC() (vncserver.ScreenCapturer, vncserver.InputInjector, bool) {
capturer := vncserver.NewMacPoller()
// Ask only when this process is the one that will capture. Screen Recording
// is a user-scope TCC service, so the request is dropped from a
// Screen Recording is asked for only when this process is the one that will
// capture. It is a user-scope TCC service, so the request is dropped from a
// LaunchDaemon: no prompt appears and NetBird never even reaches the Screen
// Recording list. In that case the per-user agent asks instead, see
// newAgentResources.
//
// Without service mode there is no agent, so this process captures and
// nothing else will ever raise the prompt — the client would serve a
// windowless desktop with no indication why.
if !vncNeedsServiceMode() {
vncserver.RequestScreenRecording()
// newAgentResources. Without service mode there is no agent, so nothing
// else will ever raise the prompt and the client would serve a windowless
// desktop with no indication why.
if vncNeedsServiceMode() {
// The per-user agent owns capture and input in service mode, so this
// process needs neither. A real injector here would still hold its
// PreventUserIdleDisplaySleep assertion from construction, keeping
// the display awake for the daemon's whole life with no VNC session
// in sight.
return capturer, &vncserver.StubInputInjector{}, true
}
vncserver.RequestScreenRecording()
injector, err := vncserver.NewMacInputInjector()
if err != nil {