Skip to content

feat(wm): cloak off-screen scrolling containers for multi-monitors#1675

Draft
CtByte wants to merge 1 commit intoLGUG2Z:masterfrom
CtByte:feat/multi_monitor_scrolling
Draft

feat(wm): cloak off-screen scrolling containers for multi-monitors#1675
CtByte wants to merge 1 commit intoLGUG2Z:masterfrom
CtByte:feat/multi_monitor_scrolling

Conversation

@CtByte
Copy link
Contributor

@CtByte CtByte commented Mar 11, 2026

Turn off animations as it makes things look weird. I am not planning on developing this any further.

Screen.Recording.2026-03-11.091739.mp4

The scrolling layout positions all containers in a horizontal strip, where only a window of N visible columns is on-screen at any time. Containers outside this visible window are placed at coordinates beyond the workspace boundaries. On a single monitor this works fine — those coordinates fall into empty virtual space and the windows are effectively invisible. On multi-monitor setups, however, those off-screen coordinates land on neighbouring monitors, causing containers to appear where they shouldn't. Because of this, the scrolling layout was restricted to single-monitor configurations.

This change removes that restriction by cloaking containers that fall outside the visible workspace area. Each update cycle, every container's layout rect is checked for horizontal overlap with the workspace bounds. Containers outside the visible region are cloaked via the existing undocumented SetCloak COM interface and their Win32 positioning calls are skipped entirely. Containers that scroll back into view are uncloaked and positioned normally. A dedicated scrolling_cloaked_hwnds set on the workspace tracks which windows are currently cloaked for scrolling purposes, kept separate from the HIDDEN_HWNDS mechanism used for workspace switching to avoid interference between the two.

Several edge cases are handled: when restoring a workspace, off-screen containers are not uncloaked to prevent a brief flash on neighbouring monitors before the layout update runs. When a window is removed from a scrolling workspace while cloaked, it is uncloaked before removal so it remains visible when managed elsewhere. When the layout changes away from scrolling or monocle is toggled on, all scrolling-cloaked windows are uncloaked. If a user Alt-Tabs to a cloaked container, the uncloak event is intercepted and the layout scrolls to reveal that container rather than following the normal reconciliation path.

…port

The scrolling layout positions all containers in a horizontal strip, where only a window of N visible columns is on-screen at any time. Containers outside this visible window are placed at coordinates beyond the workspace boundaries. On a single monitor this works fine — those coordinates fall into empty virtual space and the windows are effectively invisible. On multi-monitor setups, however, those off-screen coordinates land on neighbouring monitors, causing containers to appear where they shouldn't. Because of this, the scrolling layout was restricted to single-monitor configurations.

This change removes that restriction by cloaking containers that fall outside the visible workspace area. Each update cycle, every container's layout rect is checked for horizontal overlap with the workspace bounds. Containers outside the visible region are cloaked via the existing undocumented SetCloak COM interface and their Win32 positioning calls are skipped entirely. Containers that scroll back into view are uncloaked and positioned normally. A dedicated scrolling_cloaked_hwnds set on the workspace tracks which windows are currently cloaked for scrolling purposes, kept separate from the HIDDEN_HWNDS mechanism used for workspace switching to avoid interference between the two.

Several edge cases are handled: when restoring a workspace, off-screen containers are not uncloaked to prevent a brief flash on neighbouring monitors before the layout update runs. When a window is removed from a scrolling workspace while cloaked, it is uncloaked before removal so it remains visible when managed elsewhere. When the layout changes away from scrolling or monocle is toggled on, all scrolling-cloaked windows are uncloaked. If a user Alt-Tabs to a cloaked container, the uncloak event is intercepted and the layout scrolls to reveal that container rather than following the normal reconciliation path.
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.

1 participant