Created attachment 135996 [details] Screenshot demontrating the problem. In System Monitor's "Overview" page, in the "Applications" section, any applications that have been started through a keyboard shortcut are not listed. STEPS TO REPRODUCE 1. Create an application keyboard shortcut in System Settings->Shortcuts->Applications (see attached screenshot.) For example, I start Firefox with Meta+W and Thunderbird through Meta+M. 2. Start System Monitor. 3. Press the keyboard shortcut that launches the application. OBSERVED RESULT The application will be listed in the Overview page. EXPECTED RESULT The application should be listed in the Overview page. SOFTWARE/OS VERSIONS Linux/KDE Plasma: Gentoo Linux AMD64 KDE Plasma Version: 5.21 KDE Frameworks Version: 5.79.0 Qt Version: 5.15.2
Can you provide the output of systemd-cgls? I expect this to actually be a bug in the shortcuts code that doesn't launch the program correctly.
Apparently this is indeed the case - there's a MR for KGlobalAccel to handle this correctly that was not merged: https://invent.kde.org/frameworks/kglobalaccel/-/merge_requests/3 . In any case, moving this to KGlobalAccel.
*** Bug 441628 has been marked as a duplicate of this bug. ***
*** Bug 440499 has been marked as a duplicate of this bug. ***
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kglobalaccel/-/merge_requests/24
Git commit c6c14830a98050cbee5aa48dd8812e2197515de3 by David Redondo. Committed on 30/08/2021 at 13:45. Pushed by ngraham into branch 'master'. Start processes with kstart5 if available The intention of 717e4ea9f8e9d3f9ea5e6c8de2efbffd5ef2af82 was to start processes with kstart5 so they are in the correct cgroup. We should always check if it's available first as we still want to prefer it once klauncher is registered. M +9 -8 src/runtime/kserviceactioncomponent.cpp https://invent.kde.org/frameworks/kglobalaccel/commit/c6c14830a98050cbee5aa48dd8812e2197515de3
I applied the patch against 5.85.0 and it works. However, it breaks some applications. For example, I have a "thunderbird.desktop" file in my ~/.local/share/applications directory for launching thunderbird with kdocker (so that I can minimize it to the system tray.) It has this exec line: Exec=kdocker -d 20 -m -q thunderbird -- %u If I run kstart5 manually: $ kstart5 --application thunderbird-bin it works fine. kstart5 will run it as-is, meaning it runs kdocker and passes it the specified arguments, which in turn runs thunderbird in the system tray. However, if I try to launch it with a keyboard shortcut, then it doesn't work. The log then shows this error: kglobalaccel5[2002]: kstart: Unknown options: d, m, q.
Btw, this is not limited to custom desktop files places in ~/.local. The same happens with everything else. For example, there is: /usr/share/applications/mpv.desktop with this in it: Exec=mpv --player-operation-mode=pseudo-gui -- %U It's impossible to launch MPV now with a keyboard shortcut. Instead, you get an error: kglobalaccel5[3721]: kstart: Unknown option 'player-operation-mode'. So this commit does much more harm than good IMO.
Let's continue that conversation in https://invent.kde.org/frameworks/kglobalaccel/-/merge_requests/24#note_296525
It was reverted pending a better fix; re-opening this.
(In reply to Nate Graham from comment #10) > It was reverted pending a better fix; re-opening this. kstart5 does seem to support "-- ", where everything following it is parsed as part of the command to be executed, not as options to kstart5. For example this works when called from the command line: $ kstart5 -- kdocker -d 20 -m -q dolphin So I tested this and it works: if (!kstart.isEmpty()) { parts.prepend(command); parts.prepend("--"); QProcess::startDetached(kstart, parts);
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kglobalaccel/-/merge_requests/25
Git commit 061c45df933f6a346c85c34fe10df6f1bd857908 by Nate Graham, on behalf of Nikos Chantziaras. Committed on 02/09/2021 at 15:46. Pushed by ngraham into branch 'master'. Fix launching commands with args using kstart5 By prepending "--" to the command, kstart5 parses it all as one thing, so additional arguments are executed as expected. FIXED-IN: 5.86 M +1 -0 src/runtime/kserviceactioncomponent.cpp https://invent.kde.org/frameworks/kglobalaccel/commit/061c45df933f6a346c85c34fe10df6f1bd857908