Skip to content

Make Syphon input discovery more reliable#544

Merged
thomshutt merged 8 commits intomainfrom
fix-syphon-discovery
Feb 27, 2026
Merged

Make Syphon input discovery more reliable#544
thomshutt merged 8 commits intomainfrom
fix-syphon-discovery

Conversation

@thomshutt
Copy link
Copy Markdown
Contributor

Syphon server discovery relies on NSDistributedNotificationCenter, which delivers server announcement notifications exclusively to the main thread's NSRunLoop. In the FastAPI/uvicorn server, the main thread runs asyncio's event loop, so the NSRunLoop was never pumped. When ensure_directory_initialized() was called from a FastAPI worker thread, it pumped that worker thread's run loop instead — which receives zero notifications. This caused _get_raw_servers() to always return an empty list.

Comment on lines +328 to +334
len(
__import__("objc")
.lookUpClass("SyphonServerDirectory")
.sharedDirectory()
.servers()
or []
),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is weird, if that's so difficult to get the n of servers, then maybe just log without the number of servers?

@thomshutt thomshutt force-pushed the fix-syphon-discovery branch from 45bf421 to b70e06e Compare February 26, 2026 19:03
Signed-off-by: Thom Shutt <[email protected]>
@thomshutt thomshutt requested a review from leszko February 26, 2026 19:08
Copy link
Copy Markdown
Collaborator

@leszko leszko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a small refactor commit (renamed pump_run_loop()). Other than that LGTM. Merging.

Signed-off-by: Rafał Leszko <[email protected]>
@thomshutt thomshutt merged commit 4e52f9c into main Feb 27, 2026
6 checks passed
@thomshutt thomshutt deleted the fix-syphon-discovery branch February 27, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants