Autostarting Applications

From LinuxReviews
Jump to navigationJump to search
Mystery unlock.png

The ways desktop applications can be or are launched automatically upon logging into a desktop environment on GNU/Linux is to a large degree standardized. You can easily manually add applications you would like to auto-start to a standardized folder all the desktop environments look at, and you can just as easily use that folder to prevent applications from launching at start-up. D-Bus and applications launched by it does complicate things a bit, though.

The Freedesktop Standard[edit]

The folders $HOME/.config/autostart and /etc/xdg/autostart/ are used to specify what applications should be launched when you login to a desktop environment.

The applications listed in the system-wide /etc/xdg/autostart/ are launched if a Freedesktop-standard .desktop file is in that folder unless there is a corresponding file in the per-user folder $HOME/.config/autostart that says otherwise.

".desktop" Files[edit]

Freedesktop-standardized .desktop are files that describe a programs name, description, executable, icon file and several other things. They are use to create the menu items desktop environments show. They are also used for several other purposes.

Preventing A System-Wide Auto-Start Desktop File From Being Used[edit]

Quite a few programs will, annoyingly, install a .desktop file in /etc/xdg/autostart/ that make them auto-start upon login without being explicitly configured to do so. The Spice vdagent is one of the garbage programs that will auto-launch if the package is installed on a machine. This is caused by the file /etc/xdg/autostart/spice-vdagent.desktop. Desktop environments can be told to ignore that file by creating another file with the same name in $HOME/.config/autostart. That file would need to have a [Desktop Entry] with Hidden=true in it:

File: $HOME/.config/autostart/spice-vdagent.desktop
[Desktop Entry]
Hidden=true

The Hidden=true will, in all other cases, prevent a program from being shown in a desktop environments menu. It is seen differently if the .desktop file happens to be in $HOME/.config/autostart/, it means "do not auto-run programs in .desktop files with this name" in that case.

There are two other another oddly named key that can be used for a similar purpose: OnlyShowIn= and NotShowIn. These can be used if you would like to auto-start a program in just one or two desktop environments or not start a program in specific desktop environments. The Show part should be read as Run in when .desktop files are in $HOME/.config/autostart/.

D-Bus[edit]

The D-Bus can also launch programs automatically and it does so in a whole lot of cases. Preventing programs from being launched by D-Bus is a whole other ordeal. There is no way to make D-Bus launch or not launch programs depending on what desktop environment is being used or other factors.

The KDE Plasma desktop environment comes with a lot of software that, annoyingly, gets launched by D-Bus. The simplest way to prevent D-Bus from launching something is to eradicate whatever .service file is responsible from /usr/share/dbus-1/services.

The D-Bus/systemd files can be controlled by systemd's systemctl utility, but it's a mess. You can, for example, prevent /usr/share/dbus-1/services/org.kde.kglobalaccel.service from being launched by running:

systemctl --user mask 'dbus\x2d:1.2\x2dorg.kde.kglobalaccel.slice'

Why you would need to pre-fix it with dbus\x2d:1.2\x2 or end it with .slice is anyone's guess. The simpler solution is to just remove the .service file or uninstall the program it belongs to.


Add your comment
LinuxReviews welcomes all comments. If you do not want to be anonymous, register or log in. It is free.