Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Install service file for D-Bus activation #36

Open
ephemient opened this issue Oct 22, 2020 · 3 comments
Open

Feature request: Install service file for D-Bus activation #36

ephemient opened this issue Oct 22, 2020 · 3 comments

Comments

@ephemient
Copy link

# /usr/share/dbus-1/services/com.github.zren.PlasmaHUD.service
[D-BUS Service]
Name=com.github.zren.PlasmaHUD
Exec=/usr/lib/plasma-hud/plasma-hud

This will launch the binary on demand. XDG autostart would no longer be necessary.

@Zren
Copy link
Owner

Zren commented Oct 22, 2020

When krunner migrated to dbus startup, the first use was slow. If plasma-hud is similar, it could cause the first few keystrokes to get dropped if the user doesnt wait 1-2 seconds for the rofi window to appear.

I'll need to test this before adding the feature. It's python after all, so freeing up 40mb of RAM when not in use is a good idea. However, it's not worth ruining the performance over.

Also, if the service is always running, in the future I could pre-fetch the dbus menu before the user presses Alt or start the process on Alt press instead of after Alt is released (and kwin sends the dbus signal).

@ephemient
Copy link
Author

True, I do feel a slight delay on first launch, but it didn't feel that bad (on my admittedly well-powered machine). If that's a concern, it could still be autostarted, but with the service file, if the binary ever dies for some reason, this will kick it off again on demand instead of mysteriously disappearing.

@ephemient
Copy link
Author

Also, as for existing .desktop file, it should contain

X-DBUS-ServiceName=com.github.zren.PlasmaHUD

because https://api.kde.org/frameworks/kservice/html/classKToolInvocation.html

X-DBUS-StartupType=Unique Only start the service if it isn't already running, wait until the service has registered with D-Bus. The .desktop file can specify the name that the application will use when registering using X-DBUS-ServiceName=org.domain.mykapp. Otherwise org.kde.binaryname is assumed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants