Skip to content

Lock screen fold not visible on macOS 27: SLSShowSpaces no longer returns 0 #6

Description

@tacopiek

Environment: NUEM 1.3.0 (built from source at e11899a), macOS 27.0 (26A428), Apple Silicon. "Lock screen" is on in Settings → General.

What happens: the fold works normally when unlocked, but nothing is visible on the lock screen. The trace log still says the window went above the lock screen:

decision: closing at 113° — get a picture
closing: the kept lock screen
picture: the lock screen, 691172 ms old
frames: the picture
window: in, above the lock screen true
Fold shown at 98°
...
Fold hidden: 805 frames, ...

Cause (as far as I can tell): two private SkyLight calls behave differently on macOS 27.

  1. SLSShowSpaces no longer returns 0. It returns a different nonzero value on every run (0x55F8000, then 80936960), which looks like an undefined return value rather than an error code. LockScreen.space requires == 0, so the lock-screen space is never created and raise(_:at:) always returns false.
  2. SLSCopySpacesForWindows(cid, 7, [wid]) returns [] for an ordinary window too (the comment in isRaised says it was [1] on 26.5). Since isRaised treats an empty list as "raised", and returns true when space is nil, the log shows above the lock screen true even though the window never moved.

Test: a small standalone program using the same calls as LockScreen.swift (SLSSpaceCreate, SLSSpaceSetAbsoluteLevel at 400, SLSShowSpaces, SLSSpaceAddWindowsAndRemoveFromSpaces), ignoring the return value of SLSShowSpaces, does show its window on the lock screen on macOS 27. Output:

normal window 23294: spaces []
space 1821: setLevel(400) -> 0, show -> 80936960, add -> 80936960, level read back 400
window in space: spaces []

Possible fix: don't check the result of SLSShowSpaces. Locally, this change alone makes the fold appear on the lock screen again:

         guard id != 0,
-              unsafeBitCast(setLevel, to: SpaceSetAbsoluteLevel.self)(connection, id, notificationCenterAtScreenLock) == 0,
-              unsafeBitCast(show, to: ShowSpaces.self)(connection, [id] as CFArray) == 0 else { return nil }
+              unsafeBitCast(setLevel, to: SpaceSetAbsoluteLevel.self)(connection, id, notificationCenterAtScreenLock) == 0
+        else { return nil }
+        _ = unsafeBitCast(show, to: ShowSpaces.self)(connection, [id] as CFArray)

isRaised probably needs another way to tell on macOS 27, otherwise the self-repair in refreshLock can't notice when the window falls back behind the lock screen.

Thanks for NUEM!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions