From 36f0d175fdd87ca99ea8953f9f87b53fdde53f57 Mon Sep 17 00:00:00 2001 From: Micah Stanley Date: Wed, 13 Nov 2024 17:37:09 +0000 Subject: [PATCH] kwin/convergentwindows: keep current window maximized bugfix This fix maximizes the current window if it ever leaves a fullscreen or maximized state. This is to fix a bug where if a window exits fullscreen mode, it will not return back to a maximized state. --- .../convergentwindows/contents/ui/main.qml | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/kwin/scripts/convergentwindows/contents/ui/main.qml b/kwin/scripts/convergentwindows/contents/ui/main.qml index e32a659d..f9e0a128 100644 --- a/kwin/scripts/convergentwindows/contents/ui/main.qml +++ b/kwin/scripts/convergentwindows/contents/ui/main.qml @@ -9,6 +9,8 @@ import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings Loader { id: root + property var currentWindow + function run(window) { // HACK: don't maximize xwaylandvideobridge // see: https://invent.kde.org/plasma/plasma-mobile/-/issues/324 @@ -44,6 +46,27 @@ Loader { } } + Connections { + target: currentWindow + + function onFullScreenChanged() { + currentWindow.interactiveMoveResizeFinished.connect((currentWindow) => { + root.run(currentWindow); + }); + root.run(currentWindow); + } + + function onMaximizedChanged() { + if (!currentWindow.maximizable) { + return; + } + currentWindow.interactiveMoveResizeFinished.connect((currentWindow) => { + root.run(currentWindow); + }); + root.run(currentWindow); + } + } + Connections { target: ShellSettings.Settings @@ -70,6 +93,16 @@ Loader { } } + function onWindowActivated(window) { + if (window.normalWindow) { + currentWindow = window; + window.interactiveMoveResizeFinished.connect((window) => { + root.run(window); + }); + root.run(window); + } + } + function onScreensChanged() { // Windows are moved from the external screen // to the internal screen if the external screen