[plasma/kwin] src/scene: scene/workspacescene: add a shortcut for "show compositing"

Xaver Hugl <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit d2438b766542efab6c2fe9b5f1359c24bf2369cd by Xaver Hugl.
Committed on 21/07/2026 at 20:20.
Pushed by zamundaaa into branch 'master'.

scene/workspacescene: add a shortcut for "show compositing"

I use it often enough that opening the debug console for it after every KWin
restart gets rather annoying. You also have to close the debug console to get
a proper result, so quickly checking if a game gets direct scanout without the
shortcut is more effort than it should be.

M  +13   -0    src/scene/workspacescene.cpp

https://invent.kde.org/plasma/kwin/-/commit/d2438b766542efab6c2fe9b5f1359c24bf2369cd

diff --git a/src/scene/workspacescene.cpp b/src/scene/workspacescene.cpp
index 571948e9faf..ceb348a458a 100644
--- a/src/scene/workspacescene.cpp
+++ b/src/scene/workspacescene.cpp
@@ -78,6 +78,9 @@
 #include "window.h"
 #include "workspace.h"
 
+#include <KGlobalAccel>
+#include <KLocalizedString>
+#include <QAction>
 #include <QtMath>
 
 namespace KWin
@@ -105,6 +108,16 @@ WorkspaceScene::WorkspaceScene()
     connect(Cursors::self(), &Cursors::hiddenChanged, this, &WorkspaceScene::updateCursor);
     connect(Cursors::self(), &Cursors::positionChanged, this, &WorkspaceScene::updateCursor);
     updateCursor();
+
+    QAction *toggleAction = new QAction(this);
+    toggleAction->setProperty("componentName", QStringLiteral("kwin"));
+    toggleAction->setObjectName("Toggle Show Compositing");
+    toggleAction->setText(i18n("Toggle “Show Compositing” effect"));
+    KGlobalAccel::self()->setDefaultShortcut(toggleAction, QList<QKeySequence>());
+    KGlobalAccel::self()->setShortcut(toggleAction, QList<QKeySequence>());
+    connect(toggleAction, &QAction::triggered, this, [this]() {
+        setLayerDebugging(!m_layerDebugging);
+    });
 }
 
 WorkspaceScene::~WorkspaceScene()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.