Bug 430691

Summary: Some kde apps, when run from xfce4, are launching kdeinit5 and damaging (hijacking) system settings.
Product: [Frameworks and Libraries] frameworks-kglobalaccel Reporter: lockywolf
Component: generalAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: christoph, kdelibs-bugs, nate, nicolas.fella
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: qtdebug output

Description lockywolf 2020-12-22 02:47:25 UTC
Created attachment 134258 [details]
qtdebug output

SUMMARY

I (as many other people) use xfce4 as an everyday DE. Meanwhile (a) other people use KDE5 on the same machine, (b) I use certain KDE5 applications, such as kMyMoney and Dolphin.

On KDE4 this used to work fine. However, after an overwhelming update to KDE5, I found that launching kmymoney or dolphin modifies certain system settings (at least the default file manager and application runner). When I started to investigate how this happens, I found that krunner is launched by kdeinit5.

I installed a hook in place of kdeinit5, which would log its executions and launch the original kdeinit5 after. This is how I found that certain KDE5 apps start kdeinit5 as they are launched, and certain KDE5 apps do not.

In particular, the ones which do include: kmymoney, dolphin, akregator, backup.
The ones which do not include: konsole, kalarm, kalgebra, kaddresbook, kate, konqueror. 

STEPS TO REPRODUCE
1. Log into xfce4
2. run dolphin
3. observe that your Alt+F2 now launches krunner instead of xfce4-apprunner.

OBSERVED RESULT

Keybindings are hijacked globally.

EXPECTED RESULT

KDE apps work the way they used to work in KDE4.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Slackware-current, Linux 5.10.1, glibc 2.30
(available in About System)
KDE Plasma Version: 5.20.4
KDE Frameworks Version: 5.77.0
Qt Version: Qt 5.15.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 10.2.0) on "xcb"

ADDITIONAL INFORMATION
qtdebug output is attached.
Comment 1 Nicolas Fella 2020-12-22 13:49:32 UTC
I installed dolphin and akregator on OpenSUSE XFCE and neither the default filemanager nor the Alt-F2 shortcut were altered
Comment 2 lockywolf 2020-12-22 14:07:15 UTC
I will rebuild KDE with -ggdb and try to intercept the stack trace at the time when kdeinit5 is launched.
Comment 3 Nicolas Fella 2021-03-24 19:41:08 UTC
I noticed that some apps seem to activate the kglobalaccel service, which is responsible for the global shortcuts on Plasma. In theory that would explain the shortcut behavior you are seeing, but even with kglobalaccel5 running I don't see unusual behavior in my XFCE session
Comment 4 lockywolf 2021-03-25 01:40:27 UTC
(In reply to Nicolas Fella from comment #3)
> I noticed that some apps seem to activate the kglobalaccel service, which is
> responsible for the global shortcuts on Plasma. In theory that would explain
> the shortcut behavior you are seeing, but even with kglobalaccel5 running I
> don't see unusual behavior in my XFCE session

Firstly I would like to understand what is actually being launched by whom. Therefore I have created a separate issue about process reparenting.

https://bugs.kde.org/show_bug.cgi?id=434887
Comment 5 Bug Janitor Service 2021-04-10 15:13:06 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kglobalaccel/-/merge_requests/19
Comment 6 Nicolas Fella 2021-04-26 11:10:17 UTC
Git commit 48c3376927e5e9c13377bf3cfc8b0c411783e7f3 by Nicolas Fella.
Committed on 19/04/2021 at 22:26.
Pushed by nicolasfella into branch 'master'.

Prevent kglobalaccel5 getting activated on non-Plasma systems

While in theory kglobalaccel works on any X11 system we don't want it to run on non-Plasma systems. It isn't very useful and may interfere with the desktop's native shortcut system.

Calling some API of KGlobalAccel may result in a DBus call to the daemon which then may launch by DBus activation. Prevent that from happening on non-Plasma systems.
Related: bug 435420

M  +80   -0    src/kglobalaccel.cpp

https://invent.kde.org/frameworks/kglobalaccel/commit/48c3376927e5e9c13377bf3cfc8b0c411783e7f3
Comment 7 lockywolf 2021-12-02 13:57:41 UTC
This bug used to not happen for quite a while, but with the most recent KDE, it seems to have reemerged.

In my case now it happens with krunner intercepting Super-Space, a shortcut typically used in GTK to open window properties.
Comment 8 lockywolf 2024-02-29 15:04:57 UTC
What is the status of this bug?

There was a merge request that fixed it: https://invent.kde.org/frameworks/kglobalaccel/-/merge_requests/19/commits?commit_id=48c3376927e5e9c13377bf3cfc8b0c411783e7f3

Then there was a merge request that temporarily reverted the patch, until KF6 is released:  https://invent.kde.org/frameworks/kglobalaccel/-/commit/9a48818abf50340e31d718cc675501dec6c51429
>This sort of behavior change probably needs to be made during a major transition like KF6

Now that KF6 has been release, I do not see a revert of the reversal in the kglobalaccel commit list. But maybe it has been fixed somewhere else?
Comment 9 Nicolas Fella 2024-03-03 14:05:21 UTC
It was addressed, but in a different way.

The runtime component was split from the application-side library into a different package, so installing an application doesn't install the shortcuts runtime. And even if it is installed it will not be started automatically when an application tries to talk to it.

Instead the runtime is started as part of a Plasma session or manually, but never implicitly on non-Plasma