Skip to content

feat(desktop): show windows on every workspace - #576

Merged
houko merged 2 commits into
mainfrom
feat/window-workspaces
Nov 17, 2026
Merged

houko merged 2 commits into
mainfrom
feat/window-workspaces

Conversation

@houko

@houko houko commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes #572.

Adds desktop.SetWindowWorkspaces, WindowOptions.Workspaces (WindowWorkspacesCurrent, the default, and WindowWorkspacesAll) and TSX's Window.setWorkspaces, so desktop pets, HUDs and timers can follow the user across workspaces. The main window, which is not opened with WindowOptions, goes on every workspace by calling desktop.SetWindowWorkspaces from its content. desktop.CanSetWindowWorkspaces reports at runtime whether the request takes effect, through Environment.CanSetWindowWorkspaces, following the pattern of CanSetWindowLevel in #583.

  • macOS: a window on every workspace joins all Spaces as a full screen auxiliary window and stays out of Cmd-cycling. Its collection behavior is now computed from the level, the workspaces and the constraints together, soSetWindowLevelno longer clears it. A floating level keeps it above the windows on every Space; the desktop level keeps it behind them and out of full screen spaces.CanSetWindowWorkspaces` is true for a surface with a window of its own.
  • Linux: on X11 the window manager is asked for _NET_WM_DESKTOP = 0xFFFFFFFF on every map. CanSetWindowWorkspaces is true where gdk_x11_screen_supports_net_wm_hint finds _NET_WM_DESKTOP in the window manager's _NET_SUPPORTED, the same check GDK makes before sending the request, read when the window's environment is; it is false on Wayland, which has no protocol for it, and for an embedded view, the app's own hidden surface, a tray icon and an unmanaged panel.
  • Windows: there is no public API to pin a window to every virtual desktop (IVirtualDesktopManager only moves windows), so the window stays on the desktop it opened on and CanSetWindowWorkspaces is false. Phones and the web report false too.
  • nsgotest records the request in App.Window, and nsgotest.Environment sets CanSetWindowWorkspaces; the core, docs (architecture, public en/zh), roadmap and changelog are updated.

Targets

  • macOS: compiled and vetted for macos_arm64 and macos_x64; the macOS platform tests ran on the Mac Studio over SSH, including TestWindowWorkspacesOutliveTheLevel. Not checked by hand switching Spaces in a GUI session.
  • Linux: compiled and vetted for linux_x64 and linux_arm64; the platform package's tests ran under Xvfb with GDK_BACKEND=x11 and with GDK's default backend (which picked Wayland on the test host). The new TestWindowWorkspacesAskTheWindowManager stands in for a window manager on the bare X server and checks the _NET_WM_DESKTOP requests, their repeat after the window maps again, the return to the current desktop, and the environment with and without _NET_WM_DESKTOP in _NET_SUPPORTED. Not run against a real window manager.
  • Windows: compiled and vetted for windows_x64 and windows_arm64 only, not run (no Windows machine). It reports the feature as unavailable.
  • Shared core, desktop, TSX and nsgotest: tests run.
  • iOS, Android and Web: compiled and vetted only; the feature does not apply there and they report it unavailable.

Screenshots

None: the change is about which Spaces and virtual desktops a window appears on, which a still screenshot cannot show, and it changes no view's appearance.

Verification

All run from the branch's worktree.

  • ubuild mise exec [email protected] -- go tool nsgo check -target all: exit 0 (the Apple mobile targets are skipped there).
  • rbuild mise exec [email protected] -- go tool nsgo check -target macos_arm64,macos_x64,ios: exit 0.
  • ubuild mise exec [email protected] -- go tool nsgo test ./<pkg>/:
    • core: 664 passed, including TestWindowWorkspaces and TestEnvironmentWindowWorkspaces.
    • desktop: 2 passed, including TestWindowWorkspacesFollowTheEnvironment.
    • tsx: 166 passed, including TestWindowWorkspaces.
    • nsgotest: 70 passed.
    • internal/driver: 133 passed.
  • ubuild xvfb-run -a mise exec [email protected] -- env GDK_BACKEND=x11 go tool nsgo test ./internal/platform/linux/: 133 passed, 0 failed, 1 skipped.
  • ubuild xvfb-run -a mise exec [email protected] -- go test -count=1 -run TestWindowWorkspacesAskTheWindowManager ./internal/platform/linux/, with and without GDK_BACKEND=x11: passed. With the window's map handler removed the test fails at "shown again", and with the _NET_SUPPORTED check removed it fails in the subtest without _NET_WM_DESKTOP.
  • rbuild mise exec [email protected] -- go tool nsgo test -target macos ./internal/platform/macos/: 52 passed, 0 failed, 3 skipped.
  • gofmt -l over every .go file the branch changes: clean.
  • Not run: a manual macOS Spaces check in a GUI session, Linux against a real window manager, and anything on Windows.

Checklist

  • Conventional Commit title.
  • Changelog, public services documentation (en, zh), architecture notes, roadmap and TSX types updated.
  • No new dependencies or third-party assets.

@github-actions github-actions Bot added documentation Improvements or additions to documentation macOS Windows Linux core tsx enhancement New feature or request size/M labels Nov 17, 2026
Add desktop.SetWindowWorkspaces, WindowOptions.Workspaces and TSX's Window.setWorkspaces. On macOS a window on every workspace joins all Spaces as a full screen auxiliary window out of Cmd-` cycling, with its collection behavior computed from the level, workspaces and constraints together so SetWindowLevel no longer clears it. Linux asks an X11 window manager for _NET_WM_DESKTOP on every map; Windows and Wayland have no supported route and leave the window where it is.

Fixes #572
Add desktop.CanSetWindowWorkspaces, backed by Environment.CanSetWindowWorkspaces, so an app can tell where SetWindowWorkspaces does nothing. macOS reports it for a surface with a window of its own. Linux reports it on X11 where gdk_x11_screen_supports_net_wm_hint finds _NET_WM_DESKTOP in the window manager's _NET_SUPPORTED, the same check GDK makes before it sends the request, and not for an embedded view, the app's own hidden surface, a tray icon or an unmanaged panel. Windows, Wayland, phones and the web leave it false.

The Linux binding reuses the panels' GDK X11 display type, and a native test stands in for a window manager on a bare X server to check the requests, their repeat on map and the environment with and without _NET_WM_DESKTOP.
@github-actions github-actions Bot added conflict Conflicts with the base branch; resolve it first size/L and removed size/M labels Nov 17, 2026
@houko
houko force-pushed the feat/window-workspaces branch from 817677f to 129b303 Compare November 17, 2026 11:04
@houko
houko merged commit f9ae0d1 into main Nov 17, 2026
8 of 11 checks passed
@houko
houko deleted the feat/window-workspaces branch November 17, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflict Conflicts with the base branch; resolve it first core documentation Improvements or additions to documentation enhancement New feature or request Linux macOS size/L tsx Windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] macOS: floating windows on every Space and over full-screen apps

1 participant