Skip to content

fix(wm): preserve monocle visibility and focus on external activation - #1772

Open
MattKotsenas wants to merge 1 commit into
LGUG2Z:masterfrom
MattKotsenas:bugfix/monocle-external-activation
Open

MattKotsenas wants to merge 1 commit into
LGUG2Z:masterfrom
MattKotsenas:bugfix/monocle-external-activation

Conversation

@MattKotsenas

Copy link
Copy Markdown
Contributor

Summary

Keep monocle exclusive when an external activation reveals another managed tiled window. For example, Ctrl+clicking a link in a monocled terminal can activate an existing browser window. Before this change, the browser could become visible and receive input while komorebi's monocle target and border remained on the terminal.

With this change, the browser still opens the link, but komorebi re-hides it and restores input focus to the monocle window. Monocle stays enabled, and window and stack membership stay unchanged.

Implementation

The duplicate-management guard skips adding windows that are already managed. That also bypassed the existing monocle visibility handling.

This change handles monocle visibility in the already-managed path before skipping window addition. It re-hides the window only when it belongs to a regular tiled container on the focused workspace, the tiling layer is active, and a monocle window exists. It restores focus only if the revealed window was foreground, so background events do not steal input.

The duplicate-management guard and reconciliation ordering are retained. Floating windows and the monocle window itself are excluded from this repair.

Validation

  • Regression test failed against the baseline and passed with the fix.
  • Explicitly ran the interactive native-window test, which is ignored by default because it needs an interactive desktop. It verified actual shell cloaking and foreground restoration for both Uncloak and Show, plus preservation of unmanaged foreground focus during a background Uncloak. Disabling the explicit refocus made it fail.
  • Verified the real Windows Terminal Ctrl+click to existing Edge workflow. The original build reproduced the mismatch. With the patched daemon, Edge loaded the requested page, was re-hidden, and the terminal remained monocled and regained foreground input. Window and stack membership stayed unchanged.

The duplicate-management guard bypassed monocle visibility handling for existing tiled windows
revealed by external activation. Handle them before skipping window addition, retaining the
duplicate protection and existing reconciliation paths.

Restore foreground input to the monocle window only when the revealed window was foreground. Keep
background events from stealing focus and leave floating windows alone.

Cover the event path with native-window regression tests and an opt-in desktop test for actual
cloaking and foreground focus.

This branch has not been deployed

No deployments
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