Skip to content

fix: keep window width on KWin/Wayland when adding tabs or toggling visibility - #2354

Open
arazgray wants to merge 1 commit into
Guake:masterfrom
arazgray:fix/keep-window-width-on-kwin-wayland
Open

arazgray wants to merge 1 commit into
Guake:masterfrom
arazgray:fix/keep-window-width-on-kwin-wayland

Conversation

@arazgray

@arazgray arazgray commented Oct 9, 2026

Copy link
Copy Markdown

Problem

On KDE Plasma (KWin) Wayland sessions, where Guake runs as an XWayland client (GDK_BACKEND=x11), the main window does not keep its configured width:

  • opening a new tab shrinks the window to the VTE natural width (~80 columns, e.g. 1920px -> 1280px); hiding/showing restores it, and
  • (once the tab path is fixed) hiding/showing maps at full width and then gets snapped back to the narrow width asynchronously by the compositor.

Root cause: RectCalculator.set_final_window_rect() (guake/utils.py) is only applied on show(). Adding/removing a tab calls notebook.show_all(), which lets GTK/KWin renegotiate the toplevel to its natural size, and nothing re-asserts the configured size. KWin additionally forces a narrow size on fresh maps after show() returns, so pre-map resizes alone do not stick (verified with configure-event tracing: correct 1920px request logged, window still lands on 1280px).

Changes

  • guake/notebook.py: re-apply the final window rect (deferred via GLib.idle_add) after a tab is added (new_page()) or removed (remove_page()) while the window is visible.
  • guake/utils.py: floor the toplevel minimum width to the configured width in set_final_window_rect() (cleared on the maximize path) so the compositor cannot shrink below it.
  • guake/guake_app.py: in show(), set the rect as the WM map-time default size, flip the DOCK->NORMAL type hint before mapping instead of after, and re-assert the size after mapping; added a debounced configure-event watchdog that restores the enforced width on large unexpected shrinks (skipped when hidden/fullscreen).
  • guake/gsettings.py: keep the enforced width in sync when size/alignment settings change.

Testing

Manually verified on Kubuntu-style setup (Plasma 6 Wayland, single 1920x1080 output, window-width=100) with xwininfo: width stays at 1920px across new tabs, tab closes and hide/show cycles. py_compile passes on all touched files.

…isibility

RectCalculator.set_final_window_rect() was only applied on show().
Adding/removing a tab (notebook.show_all()) let KWin/XWayland shrink the
window to the VTE natural width, and a fresh map was snapped back to it
asynchronously. Re-assert the configured size after tab changes, floor
the minimum width, and watch configure events for late snap-backs.
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