KDE Plasma: converting xdg/autostart units to systemd services

There are many issues with servcices autostarted with Plasma, that could work way better if they were systemd services.

This shouldnt be too complex, and in the end I think this should be the default.

But during experimentation I got many issues I cant solve on my own currently.

I am using Kinoite to test this.

In general, systemd-xdg-autostart-generator is the tool that converts .desktop files to systemd user services. This allows the desktop environment to use their existing mechanism to configure autostart, but actually use systemd user instance to manage the services.

The mechanism implemented by /etc/xdg/autostart is generic, and systemd-xdg-autostart-generator tries to be DE-agnostic. AFAIK, it has been adopted by GNOME. I don’t know the status for KDE. This kind of thing is best done in cooperation with the developers of the DE, because it’s very likely that adjustments need to be made in how the DE starts processes. Thus, I’d recommend continuing the thread on discuss.kde.org rather than here.

1 Like

Actually, what Gnome has done is converting all autostart units to real user units stored in /usr/lib/systemd/user.

For other DEs, you could get problems because the programs could already be started by the session manager. The systemd-xdg-autostart-generator can be useful for DEs which don’t have their own session manager.

So to converts, you should create systemd unit files in /etc/systemd/user, and at the same time disable the /etc/xdg/autostart units.

1 Like

Thanks interesting tool!

Afaik the benefit of this (very limited) approach is to be init system agnostic.

But it should be pretty trivial to convert these entries, and yes it should absolutely be done with devs. But I will test this first with noncritical processes and see if it works well.

@vekruse I am currently writing a script that does this on an existing system. When it is ready I can share it and more people can test it in a VM.

Which exact approach? The xdg/autostart is what was available before systemd was created. Now systemd provides an alternative.

2 Likes

Yes but I meant even systems without systemd could use the old variant.

Dont know how a patch could be written nicely, to allow using both methods.

Will test tomorrow! I already replaced all the services I dont want, and will try the entire thing in a fresh Kinoite VM tomorrow.

Some cool things:

  • only launch XWaylandVideoBridge when using Wayland
  • only launch the SPICE, VirtualBox and VMWare agents when being the respective client

this belongs to the set of “wheel-less” things that need manual config