Skip to content

fix: place GNOME break overlay on each monitor in multi-monitor setups - #163

Closed
Erudition wants to merge 2 commits into
AllanChain:mainfrom
Erudition:fix-gnome-multi-monitor
Closed

fix: place GNOME break overlay on each monitor in multi-monitor setups#163
Erudition wants to merge 2 commits into
AllanChain:mainfrom
Erudition:fix-gnome-multi-monitor

Conversation

@Erudition

@Erudition Erudition commented Jul 27, 2026

Copy link
Copy Markdown

Problem

On GNOME/Wayland with multiple monitors, the break overlay is sized to the whole virtual desktop and placed on the wrong monitor, so it appears cut off or offset on non-primary displays.

Root cause

Two coordinate mismatches:

  1. The Qt break window uses global screen coordinates for the mainWidget child widget inside the Wayland workaround window, but the parent window is later moved/resized by the GNOME extension to a single monitor.
  2. The GNOME extension resizes each break window to global.display.get_size() (the whole desktop) instead of the target monitor's geometry.
  3. On Wayland, MetaWindow.move_to_monitor() is asynchronous. The extension was calling move_to_monitor() and then immediately move_resize_frame(), so the resize happened before the window actually entered the target monitor, causing the overlay to be sized/positioned for the wrong display.

Fix

  • src/app/break-window.cpp: in the m_waylandWorkaround branches, use coordinates relative to the parent window frame for mainWidget geometry.
  • packaging/linux/gnome/sane-break@allanchain.github.io/extension.js: detect which monitor each break window was created on; if it is already on that monitor, resize immediately; otherwise call move_to_monitor() and wait for the window-entered-monitor signal before resizing. A 750 ms fallback timeout ensures the resize still happens if the signal is never emitted.

Notes

  • This intentionally touches only the Wayland workaround path; layer-shell and X11 paths are unchanged.
  • Tested on a three-monitor setup (vertical left, center primary, laptop right).

@Erudition
Erudition force-pushed the fix-gnome-multi-monitor branch from 2ac592c to 202b7e3 Compare July 27, 2026 20:50
…around

On Wayland the GNOME extension resizes the transparent workaround window
to span the whole virtual desktop, so calling screen() at show-time always
returns the primary monitor. Store the QScreen geometry in initSize() and
use that for all Wayland-workaround geometry computations.
Revert to sizing the transparent Wayland workaround window to the full
virtual desktop with global.display.get_size(). The break window now
remembers its intended monitor geometry, so monitor detection and
move_to_monitor in the extension are no longer needed.
@Erudition
Erudition force-pushed the fix-gnome-multi-monitor branch from fe14c02 to 6d04554 Compare July 27, 2026 22:44
@AllanChain

Copy link
Copy Markdown
Owner

Thanks for the contribution. I used a Debian virtual machine for testing, which does not have a multi-display setup. I'll trust your testing and only review the code quality. But before that, there are some merge conflicts to be resolved, which are possibly caused by a recent update to automatically add/remove windows on display change. You can ping me to review the code once you are ready.

@AllanChain AllanChain closed this in 8ed6c9b Aug 1, 2026
@AllanChain

Copy link
Copy Markdown
Owner

I have figured out how to simulate multi-display for VMs and found a better way to fix this in 8ed6c9b. Thanks for your time and token anyway.

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.

2 participants