summarylogtreecommitdiffstats
path: root/0002-add-KeepAbove-support-on-Wayland.patch
blob: 2b4b757a0d8f28d2709fdf9c33dcd433f8827a14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
From 079a9b93a7f39ff21a02a51184465f02d21c5305 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Benigno=20Batista=20J=C3=BAnior?=
 <benigno@opus-software.com.br>
Date: Wed, 25 Feb 2026 15:21:48 -0300
Subject: [PATCH 2/3] add KeepAbove support on Wayland
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Set PlasmaShellSurface role to Panel when KeepAbove is enabled.
Based on KDE MR !137 by Pierre Bourré.

BUG: 470144
---
 app/mainwindow.cpp | 19 ++++++++++++++++---
 app/mainwindow.h   |  1 +
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp
index c9cf37e..7a9874a 100644
--- a/app/mainwindow.cpp
+++ b/app/mainwindow.cpp
@@ -193,6 +193,20 @@ void MainWindow::initWaylandSurface()
         m_plasmaShellSurface->setPosition(pos());
         m_plasmaShellSurface->setSkipTaskbar(true);
         m_plasmaShellSurface->setSkipSwitcher(true);
+        m_plasmaShellSurface->setPanelTakesFocus(true);
+        applyWaylandSurfaceProperties();
+    }
+}
+
+void MainWindow::applyWaylandSurfaceProperties()
+{
+    if (!m_plasmaShellSurface)
+        return;
+
+    if (Settings::keepOpen() && !Settings::keepAbove()) {
+        m_plasmaShellSurface->setRole(KWayland::Client::PlasmaShellSurface::Role::Normal);
+    } else {
+        m_plasmaShellSurface->setRole(KWayland::Client::PlasmaShellSurface::Role::Panel);
     }
 }
 
@@ -960,9 +974,8 @@ void MainWindow::applyWindowProperties()
     }
 
 #if HAVE_KWAYLAND
-    if (m_isWayland && m_plasmaShellSurface) {
-        m_plasmaShellSurface->setSkipTaskbar(true);
-        m_plasmaShellSurface->setSkipSwitcher(true);
+    if (m_isWayland) {
+        applyWaylandSurfaceProperties();
     }
 #endif
 
diff --git a/app/mainwindow.h b/app/mainwindow.h
index 5714d39..79f3318 100644
--- a/app/mainwindow.h
+++ b/app/mainwindow.h
@@ -215,6 +215,7 @@ private:
 #if HAVE_KWAYLAND
     void initWayland();
     void initWaylandSurface();
+    void applyWaylandSurfaceProperties();
     bool m_availableScreenRectValid = false;
     int m_cachedScreenIndex = -1;
     KWayland::Client::PlasmaShell *m_plasmaShell = nullptr;
-- 
2.53.0