Fix System Tray widget global shortcuts not working
Fix System Tray widget global shortcuts not working
Summary
This patch fixes a bug where global keyboard shortcuts assigned to the System Tray widget are registered in kglobalaccel but do not activate the widget. The root cause is that System Tray disconnects the default activated signal handler but never connects its own.
This is a regression introduced in Plasma 6.0 during the nested containment refactoring and remains unfixed in master as of November 2025.
Bug Description
Affected versions: Plasma 6.0 - 6.5.2, master
Regression from: Plasma 5.21+ (where it worked correctly)
Severity: Medium - Feature regression from Plasma 5
Git history verified: Bug NOT fixed in any version 6.0+
When users assign a global shortcut to the System Tray widget through the GUI (Configure System Tray → Keyboard Shortcuts):
- The shortcut is saved in configuration
- The shortcut is registered in kglobalaccel
- Pressing the shortcut sends the
activatedsignal - Nothing happens - the System Tray does not expand
This works correctly for other widgets like Analog Clock, which use the default PlasmoidItem handler.
Fixed bugs
Full bug thread: https://bugs.kde.org/show_bug.cgi?id=483688#c9
Root Cause
In plasma-workspace/applets/systemtray/systemtray.cpp lines 63-67, the System Tray explicitly disconnects the activated signal from child applets:
// we don't want to automatically propagate the activated signal from the Applet to the Containment
// even if SystemTray is of type Containment, it is de facto Applet and should act like one
connect(this, &Containment::appletAdded, this, [this](Plasma::Applet *applet) {
disconnect(applet, &Applet::activated, this, &Applet::activated);
});
However, no handler is connected for the System Tray's own activated signal, unlike other widgets which inherit the default behavior from PlasmoidItem (plasma-framework/src/plasmaquick/plasmoid/plasmoiditem.cpp:99-105).
Verification
# Shortcut IS registered in kglobalaccel
$ qdbus6 org.kde.kglobalaccel /component/plasmashell \
org.kde.kglobalaccel.Component.allShortcutInfos | grep "activate widget"
# Shows: [Argument: ai {234881108}] ✓
# Signal IS sent when shortcut is pressed
$ qdbus6 org.kde.kglobalaccel /component/plasmashell \
org.kde.kglobalaccel.Component.invokeShortcut "activate widget 8"
# Executes without error ✓
# But System Tray does NOT respond ✗
Solution
Add a QML handler for the activated signal in the System Tray's main.qml to toggle the expanded state.
Changes
File: applets/systemtray/package/contents/ui/main.qml
After the Component.onCompleted block (line 46), add:
// BUGFIX: Handle activated signal to toggle expansion (for global shortcuts)
Connections {
target: Plasmoid
function onActivated() { systemTrayState.expanded = !systemTrayState.expanded; }
}
Testing
- Right-click System Tray → Configure System Tray
- Go to Keyboard Shortcuts tab
- Assign a shortcut (e.g., Ctrl+Alt+Shift+T)
- Click Apply
- Press the assigned shortcut
- Expected: System Tray popup appears/disappears
- Before patch: Nothing happens
- After patch: System Tray toggles correctly ✓
Related Code
- plasma-framework/src/plasmaquick/plasmoid/plasmoiditem.cpp:99-105 - Default activated handler that works for other widgets
- plasma-workspace/shell/kconf_update/plasma6.0-remove-old-shortcuts.cpp - Migration script that mentions widget shortcuts should be handled explicitly in Plasma 6
Related Commits
-
04112536 (Oct 2020, Plasma 5.21) - Original fix that worked in Plasma 5 by adding
setGlobalShortcut()inrestoreContents()and thedisconnect()line - 46ada24f (Mar 2024, Plasma 6.0) - Refactored to nested containment, regression likely introduced here
- 9c872a54 (Jun 2024, Plasma 6.2) - Fixed shortcuts for child applets inside System Tray, but not for System Tray itself
- cb73a963 (Feb 2025, master) - Focus improvements, unrelated to shortcuts
Analysis: The bug has been present since Plasma 6.0 and remains unfixed in master (verified Nov 2025).
Notes
- This regression was introduced in Plasma 6.0 when the automatic signal propagation was removed
- The comment in systemtray.cpp indicates this was intentional, but no replacement handler was added
- Other containment-based widgets may have the same issue and need similar fixes
- This does not affect widgets that use the standard
PlasmoidItembehavior
Checklist
-
Patch applies cleanly to v6.4.5 -
Tested on Kubuntu 25.10 with Plasma 6.4.5 -
No compilation warnings introduced -
Feature works as expected after patch -
Does not affect other System Tray functionality -
Follows existing code style (QML Connections pattern)
Reported by: Mikhail Pavlovich Sidorenko via Cursor
Tested on: KDE Plasma 6.4.5, KDE Frameworks 6.17.0, Qt 6.9.2
Date: 2025-11-12