cosarara.me

The blog

KRunner and D-Bus

Today I pressed my awesome shortcut for layout switching and found that it didn’t work. Instead, something called KRunner popped up. BUT WHY?

What followed was an investigation. Typing krunner on google already explained the first thing: KRunner binds to Alt-F2 and Alt-SPACE.

krunner google query

Now why was krunner running?

> ps ax | grep krunner
2343941 ?        Sl     0:00 /usr/bin/krunner
2382396 pts/10   S+     0:00 grep --color=auto krunner

Pretty high PID, it sure didn’t start with the system. Who is its parent?

> cat /proc/2343941/status | rg -i ppid
PPid:   1477
> ps ax | grep 1477
1477 ?        Ss     0:00 /usr/lib/systemd/systemd --user

Oh boy, it’s our friend systemd --user. Now how did this end up happening?

> systemctl --user status 2343941
● dbus.service - D-Bus User Message Bus
     Loaded: loaded (/usr/lib/systemd/user/dbus.service; static; vendor preset: enabled)
     Active: active (running) since Thu 2020-01-16 17:02:17 CET; 1 weeks 0 days ago
TriggeredBy: ● dbus.socket
       Docs: man:dbus-daemon(1)
   Main PID: 1512 (dbus-daemon)
     CGroup: /user.slice/user-1000.slice/user@1000.service/dbus.service
             ├─   1512 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nop…
             ├─   1578 /usr/lib/ibus/ibus-portal
             ├─   2255 /usr/lib/dconf-service
             ├─2343766 /usr/lib/kactivitymanagerd
             ├─2343773 /usr/bin/kglobalaccel5
             └─2343941 /usr/bin/krunner

D-Bus, that little guy I’ve never known what exactly it does but is always there. www.freedesktop.org/software/dbus/ tells us:

In addition to interprocess communication, D-Bus helps coordinate process lifecycle; it makes it simple and reliable to code a “single instance” application or daemon, and to launch applications and daemons on demand when their services are needed.

So, someone asked the magic D-Bus to run krunner for them.

> journalctl --user --unit=dbus
[...] Activating service name='org.kde.ActivityManager' requested by ':1.335' \
(uid=1000 pid=2343761 comm="kate -b ")
[...] Successfully activated service 'org.kde.ActivityManager'
[...] Activating service name='org.kde.kglobalaccel' requested by ':1.336' \
(uid=1000 pid=2343766 comm="/usr/lib/kactivitymanagerd ")
[...] Successfully activated service 'org.kde.kglobalaccel

Oh, Kate! I remember running Kate the other day to open some file!

So the process is like that:

  1. Kate starts the KDE Activity Manager
  2. The Activity Manager starts the kglobalaccel thing
  3. The kglobalaccel thing binds Alt-F2 and Alt-SPACE to start krunner.

And basically I hate everything and sometimes the alt+space bind overrides my WM’s and sometimes not.

—cosarara

Got any comments? Send me an email: blog@cosarara.me