Skip to content

Fix window shrinking to 2/3 of the screen width on KDE Plasma - #2353

Open
Di0go wants to merge 1 commit into
Guake:masterfrom
Di0go:fix-kde-width-unmaximize
Open

Di0go wants to merge 1 commit into
Guake:masterfrom
Di0go:fix-kde-width-unmaximize

Conversation

@Di0go

@Di0go Di0go commented Oct 8, 2026

Copy link
Copy Markdown

Closes #2117

Problem

On KDE Plasma, with window-width at 100% and window-height below 100%, the window sometimes shrinks to 2/3 of the screen width (1280 px on a 1920 px screen). It happens when leaving fullscreen or when the height changes, and the window stays narrow until something resizes it again.

Cause

  • When the window is mapped and its width fills the work area, KWin marks it as maximized horizontally, and saves no width to restore to (x11window.cpp#L589-L634).
  • RectCalculator.set_final_window_rect() calls window.unmaximize() every time it sets the size.
  • KWin handles the unmaximize by restoring the window. With no saved width, it uses its fallback: 2/3 of the work area width (x11window.cpp#L3625-L3644).
  • Guake's own resize() is sent at the same time, so the final width depends on which request KWin handles last. That is why it looks random.

Fix

Call unmaximize() only when window.is_maximized() is true. GTK reports a window as maximized only when it is maximized in both directions, so:

  • a window Guake maximized itself (width and height at 100%) is still unmaximized when the size changes, as before;
  • the horizontal-only flag set by KWin is left alone, and the window keeps the size Guake asked for.

This is a different change from #2323. That PR changes how the size is applied (move_resize); this one removes the extra unmaximize. They touch different lines of the same function.

How this matches the reports in #2117

  • "The issue disappears if the window width is not exactly 100%", and the workaround with a 1 px displacement: KWin only sets the flag when the window is at least as wide as the work area.
  • Setting the height to 100% avoids it: Guake then calls maximize() and skips the unmaximize() branch.
  • Opening a new tab or changing the height brings the full width back: after the first restore KWin has cleared the flag, so the next unmaximize() does nothing and resize() wins.
  • It comes back after hiding and showing: the window is mapped again, and KWin sets the flag again.
  • The F11 steps posted on 2023-04-08 follow the same path as the test below.
  • The debug log in the thread shows set_final_window_rect computing the correct width: Guake asks for the right size, and KWin changes it afterwards.
  • Building from source seemed to fix it, but it came back later: it is a race between two requests, so it depends on timing.
  • The GNOME report (Guake 3.7.0) looks like a different problem, and it went away after updating to 3.9.0. This PR does not change anything there.

Testing

Environment: KDE Plasma 6 on Wayland, Guake on XWayland (X11 backend), GTK 3.24.52, 1920x1080 screen.

I ran the installed Guake 3.10.1 twice, unmodified and patched, each in its own D-Bus session and config directory, with height 58%, bottom alignment and width 100%. A script showed the window, toggled fullscreen four times over D-Bus, then changed window-height twice. A KWin script logged the window geometry and KWin's maximizeMode (2 = maximized horizontally).

Unmodified, the first time it leaves fullscreen:

shown              1920x626   maximizeMode=2
fullscreen         1920x1080  maximizeMode=2
leave fullscreen   1920x626   maximizeMode=2
                   1280x626   maximizeMode=0   <- after unmaximize()

Patched: every step stayed 1920 px wide (626 px tall, 615 px at 57%), with maximizeMode=2 the whole time.

Checks: black --check, flake8, pylint (no new messages), reno lint and pytest (30 passed) all pass. I used the versions pinned in the Pipfile, on Python 3.14, the only Python on my machine.

KWin marks a window as maximized horizontally when its width fills the
screen. Guake called unmaximize() every time it set the window size, so
KWin restored the window to its fallback size, 2/3 of the screen width.
This happened when leaving fullscreen or when changing the height, and
the window stayed narrow.

Check is_maximized() first. GTK only reports a window as maximized when
it is maximized in both directions, so a window Guake maximized itself
(100% width and height) is still unmaximized as before.

closes Guake#2117

sem-ver: bugfix
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.

Kubuntu 22.04 Guake not using full width

1 participant