Private frameworks
Frameworks
SkyLight2305 symbols · 21 topics · The private window-server framework behind the macOS UI: windows, spaces, displays, the menu bar, the login/lock session, and the event stream.
Calling these from Swift
let path = "/System/Library/PrivateFrameworks/SkyLight.framework/Versions/A/SkyLight"
guard let lib = dlopen(path, RTLD_NOW) else { /* framework gone: handle it */ }
// Every symbol is resolved by name, so a renamed or removed call is a nil you can
// check — not a process that fails to launch, which is what linking would give you.
typealias SLSMainConnectionID = @convention(c) () -> Int32
guard let p = dlsym(lib, "SLSMainConnectionID") else { /* not on this macOS */ }
let cid = unsafeBitCast(p, to: SLSMainConnectionID.self)()
// The connection id is the first argument of nearly every other call.
typealias GetMenuBarAutohide = @convention(c) (Int32, UnsafeMutablePointer<Bool>) -> Int32
var autohide = false
let err = unsafeBitCast(dlsym(lib, "SLSGetMenuBarAutohideEnabled")!,
to: GetMenuBarAutohide.self)(cid, &autohide) // err == 0 on success