Repository navigation
feat: list Spaces and switch a display's Space - #66
Merged
Merged
Conversation
iamnbutler
force-pushed
the
feat/spaces
branch
from
October 17, 2026 04:32
dd5595d to
d93b3df
Compare
This was referenced Oct 17, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Spaces support (A and B of the Spaces plan). Moving a window between Spaces (C) stays unsupported and is documented.
desktop_spaces(read only, sends no input)space_id, a one-basedindex,kind(desktop or fullscreen),is_current, and the windows assigned to each (pid, window_id and app name, no titles; capped at 50 per Space).desktop_screenindex, bounds andcurrent_space_id. Also reportsspans_displays.focusgives the pointer's display and the frontmost app's frontmost window and its display.switch_leftandswitch_rightread Mission Control's shortcuts (symbolic hotkeys 79 and 81) fromcom.apple.symbolichotkeys.desktop_windowsrows gainspace_ids.CGSCopyManagedDisplaySpaces,CGSCopySpacesForWindowsand_CGSDefaultConnectiondirectly in the client. These are read only and need no permission. I didn't use Peekaboo'sSpaceManagementServicebecause itsresolveDisplayIDmaps every display to the firstNSScreen, andisActiveuses the global active Space. Displays are matched by UUID throughCGDisplayCreateUUIDFromDisplayID.desktop_switch_space(foreground input)space_id.desktop_system_keyuses), one step at a time. After each step it polls WindowServer for up to 2 s for the expected next Space and stops if that Space doesn't appear.completedonly when the final read shows the target as current; otherwiseunknown, withspace_after.completedwith nothing sent.ctrl,leftandctrl,rightare sent.Docs: new Spaces section in
docs/tools.md, which also covers Mission Control and App Exposé viadesktop_system_keycontrol up/down. New Not-supported bullet: moving windows between Spaces is Dock-only since macOS 14.5, with the manual route (Mission Control viadesktop_system_key, then a foregrounddesktop_drag). The tool count goes from 39 to 41. No bridge op or patch change, so the op count stays at 127.Checked live (dev app signed with the Developer ID identity, against the running host):
spacesread: 2 displays, 1 Space each, shortcuts enabled.completed, nothing sent.npm run checkpasses.desktop_windowsspace_ids: Finder's windows report Space 1, and its hidden helper windows report none.Pending: screen locked
ctrl,left/ctrl,rightwithout the fn flag triggers the Space switch.