Every now and then my background image does not load and Openbox starts with a gray background. I suspect a race condition with startup events. This is my ~/.config/openbox/autostart file:
# compositor - background process + disable shadowing effects during session
picom -CGb &
# notifications
/usr/bin/dunst &
# panel - taskbar, system tray, battery, clock
tint2 &
# network manager
nm-applet &
# Autostart
dex -a -s /etc/xdg/autostart/:~/.config/autostart/ &
# Set display from arandr saved script
sh ~/.screenlayout/monitor.sh &
# Polkit
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &
# Wallpaper
nitrogen --restore &
# Low battery notifier
#~/.config/openbox/scripts/low_bat_notifier.sh &
# Start redshift and put an icon in the systray
redshift-gtk &
While searching for a fix I ran across a discussion that included when and if ampersands are needed.
Relevent parts of the discussion:
Replier to OP’s original autostart question:
Are you sure all those ampersands are necessary? Run each command in a terminal and only add an ampersand in the autostart file if the prompt is not returned, this will help avoid any potential race conditions. I know for sure that picom shouldn’t have both an ampersand and the -b option applied at the same time.
Op’s response
As for the ampersands, I was following the Arch man page for Openbox
Replier’s response
In this case the man page is incorrect — adding ampersands where they are not needed can precipitate race conditions. An ampersand is only needed if the command does not return the prompt after it is run in a terminal.
Now the $1000 questions:
-
Are ampersands required to end every command line in a startup or autostart script?
-
Will they possibly start a race condition if not needed?
I removed the ampersand from the picom line and the problem of nitrogen not starting a background image seems to have disappeared. But that is just anecdotal and no real data to back it up.