STEPS TO REPRODUCE 1. Add a Trash widget to a panel 2. Open Dolphin 3. Click on the Trash widget OBSERVED RESULT The Dolphin window opens trash:/ in a new tab, but the window does not come forward. SOFTWARE/OS VERSIONS Git master everything on top of Fedora KDE 41 with Qt 6.8.2 ADDITIONAL INFORMATION Somehow it only affects the Trash widget. Clicking on it simply runs: > Plasmoid.onActivated: Qt.openUrlExternally("trash:/") However Qt.openUrlExternally() works as expected to raise Dolphin when invoked from a little test program: import QtQuick import QtQuick.Controls as QQC Item { width: 300 height: 300 QQC.Button { anchors.centerIn: parent text: "Open Trash" icon.name: "user-trash-symbolic" onClicked: { Qt.openUrlExternally("trash:/") } } } And Qt.openUrlExternally() raises dolphin when invoked from the slideshow wallpaper config UI, where added folders display "Open folder…" buttons. So somehow, the issue seems to be specific to just the Trash widget!
Problem is this line: https://invent.kde.org/qt/qt/qtbase/-/blob/dev/src/gui/platform/unix/qdesktopunixservices.cpp#L446 QWindow *window = qGuiApp->focusWindow(); focusWindow() is null, presumably because plasmashell isn't your average application. And without a window we can't get a token
Fascinating. I guess it works from a widget's FullRepresentation because that's technically a window, right?
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/2957
Git commit a2ed9f88c16a8b8be504c1a0b9c7a93b8b65415f by Kai Uwe Broulik. Committed on 22/04/2025 at 13:46. Pushed by broulik into branch 'master'. applets/trash: Use KIO CommandLauncherJob to open trash QDesktopServices::openUrl (through Qt.openUrlExternally) requests a token from the focus window. When trash is clicked in a panel, the panel doesn't have focus, resulting in no token being created. KProcessRunner used by KIO CommandLauncherJob as a fallback takes whatever first window in qApp making activation work. While at it, also use KNotificationJobUiDelegate for proper error reporting in case opening trash fails. M +1 -1 applets/trash/package/contents/ui/main.qml M +1 -0 applets/trash/plugin/CMakeLists.txt M +10 -0 applets/trash/plugin/trash.cpp M +1 -0 applets/trash/plugin/trash.h https://invent.kde.org/plasma/plasma-desktop/-/commit/a2ed9f88c16a8b8be504c1a0b9c7a93b8b65415f