Space Monitor is a Rust API for subscribing to real-time changes on Mac OS X to obtain the current active space (virtual desktop) index. Surprisingly,

Search code, repositories, users, issues, pull requests...

submited by
Style Pass
2024-10-26 17:00:07

Space Monitor is a Rust API for subscribing to real-time changes on Mac OS X to obtain the current active space (virtual desktop) index.

Surprisingly, obtaining the active virtual desktop index is a non-trivial task on Mac OS X and attempts in doing so have been breaking release after release as the method relies on undocumented Mac OS native APIs.

While you can occassionally deciper some esoteric plist files to derive the active screen via defaults read com.apple.spaces SpacesDisplayConfiguration, the contents are almost always incorrect and out of date, which makes it a non-starter for realtime change detection.

As this crate relies on private, undocumented native Mac OS APIs internally, I believe your app would be rejected from the Apple app store if this crate is used within your application. However, users can still install the application externally.

Leave a Comment