Managing application autostarts in Openbox

Share your own howto's etc. Not for support questions!

Managing application autostarts in Openbox

Postby MartinK » 2015-05-23 12:13

This 'How To' relates to the operation of Openbox when used as both your window manager and desktop environment, specifically in respect of autostarting applications. It describes autostart problems I encountered and the solution I adopted to those problems. I am running Debian 8, i.e. jessie.

Background
After upgrade from wheezy to jessie I found I had additional applications autostarting when I ran startx. This on two machines, both Debian with Openbox plus tint2 panel. It was not obvious what was causing these autostarts. The systems also have LXDE installed. (My original install of Debian was with LXDE as the selected desktop environment).

Introduction to autostarts
Two systems can autostart applications on the Debian 8 / Openbox platform, Openbox itself and the associated X Window infrastructure. The relevant X components are seen in directories with names including "XDG".

Some applications may demand that others be autostarted too.

Openbox
Openbox has it's own all users and per user autostart mechanism, all users runs first;
/etc/xdg/openbox/autostart
~/.config/openbox/autostart

For details see;
http://openbox.org/wiki/Help:Autostart

XDG (freedesktop.org - previously X Desktop Group)
XDG adds it's autostarts. From looking at freedesktop.org I conclude;
.desktop files placed in the following locations will autostart applications, at user level and system wide. User level takes priority. (Environment variables may be set to override these default locations).

~/.config/autostart/
/etc/xdg/autostart/

To have a .desktop file ignored for autostart purposes add the "Hidden" key with value "true" to the file.

Keys "OnlyShowIn", "NotShowIn", specify in which DE's an application will, or will not, autostart.

For details see;
http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html
http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html

Troubleshooting
Armed with the information above I still could not understand why some applications were autostarting.

nm-applet
My testing indicates that the Network Manager applet demands that a notification server is running. My preferred notification utility is Dunst.

* If dunst is already running nm-applet uses dunst
* If dunst is not already running nm-applet by preference starts notification-daemon
* If dunst is not already running and notification-daemon autostart is disabled nm-applet starts dunst

I have not worked out how this is being done.

.desktop files and variable XDG_CURRENT_DESKTOP
The .desktop files include lines of the form;

OnlyShowIn=OPENBOX;GNOME;LXDE;

The DE names are checked against the value of the variable XDG_CURRENT_DESKTOP. On both my machines starting LXDE sets the value of this variable to LXDE. Starting Openbox sets no value to this variable. I initially assumed if no value was set the conditional test for OPENBOX would fail; but the applications start.

There is a package "desktop-file-utils" which includes the "desktop-file-validate" command. Example output follows;

Code: Select all
notification-daemon.desktop: error: value "OPENBOX;GNOME;LXDE;" for key "OnlyShowIn" in group "Desktop Entry" contains an unregistered value "OPENBOX"; values extending the format should start with "X-"


It seems OPENBOX is not a valid value, possibly why Openbox does not assign it to XDG_CURRENT_DESKTOP. Removing "OPENBOX;" from the line "OnlyShowIn=OPENBOX;GNOME;LXDE;" results in a file that passes the validation test, and Openbox not autostarting the notification-daemon.

Many of the .desktop files have lines of the form;

AutostartCondition=GNOME3 unless-session gnome

This key "AutostartCondition" is not listed in the Recognized desktop entry keys standards document but it's presence does not cause .desktop file validation to fail.

Solution adopted
Openbox - The autostart file is just a script listing executables. Use the user level file only, i.e. ~/.config/openbox/autostart.

XDG - This is where the interference to my setup came from. To stop unwanted autostarts copy the relevant .desktop file to ~./config/autostart/ and add the line

Code: Select all
Hidden=true


I hope this is of use to others.

Regards,
Martin.
MartinK
 
Posts: 25
Joined: 2015-05-14 21:55
Location: United Kingdom

Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: paperparachute and 6 guests

fashionable