Skip to content

Rejoin all Spaces when the pointer turns on - #30

Open
jorgenbruntveit wants to merge 1 commit into
nilbuild:mainfrom
jorgenbruntveit:fix-full-screen-spaces
Open

jorgenbruntveit wants to merge 1 commit into
nilbuild:mainfrom
jorgenbruntveit:fix-full-screen-spaces

Conversation

@jorgenbruntveit

Copy link
Copy Markdown

Fixes #9.

Problem

After a while the hand stops showing in full-screen apps. The pointer turns on, taps play their sound, but nothing is drawn. It keeps working on the normal desktop, and restarting TinyHand fixes it until it happens again. The log shows the existing re-show attempt failing:

space changed, overlay on active space=false
re-showed overlay, now on active space=false

Cause

It happens when a full-screen Space closes, for example when you close a document that was in full screen or take an app out of full screen. If the overlay and toolbar are hidden at that moment (pointer off), macOS keeps them on the current Space only, even though they still have .canJoinAllSpaces. I checked this with CGSCopySpacesForWindows: the overlay goes from [19, 930, 3] (desktop plus two full-screen apps) to [3]. Windows that are visible when the Space closes are not affected.

Showing the window again does not undo it, and neither does assigning the same collectionBehavior, or clearing and re-setting it in one pass. What works is removing .canJoinAllSpaces, letting the change reach the window server, then adding it back. CATransaction.flush() in between is enough.

Changes

  • NSWindow.rejoinAllSpaces() in AppKitHelpers.swift removes .canJoinAllSpaces, flushes, and adds it back.
  • OverlayController.activate() calls it on the overlay and on the toolbar panel and ink tray before showing them. The hint panel is created fresh each time, so it does not need it.

Testing

Tested on macOS 27.3 with Obsidian and a browser in full screen. I closed a full-screen window while the pointer was off, which reproduces the bug every time, then turned the pointer on. Without the change the overlay and toolbar stay on [3] and the hand is missing in the full-screen apps. With it they are back on all three Spaces and the hand shows in both apps.

Side note: with only Command Line Tools installed, swift build fails against the macOS 27.2 SDK because the SwiftUI @State macro plugin is missing. I built with SDKROOT pointing at the 26.5 SDK.

When a full-screen Space closes while the pointer is off, macOS keeps
the hidden overlay and toolbar on the current Space only, so the hand
no longer shows in other full-screen apps until TinyHand restarts.
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.

Not working on multiple spaces in Mac

1 participant