Openbox autostart sleep delays?

Hi

I am really enjoying Archlabs - its wonderful - thanks!

In order to get what I want, i.e, this:


(Monitor is ‘above’ Laptop)

I have the below in my autostart fle:

# required for xfce settings to work
xfsettingsd &

# Monitors
(sleep 1 && xrandr --output eDP1 --mode 1366x768 --pos 277x1080 --rotate normal --output DP1 --off --output HDMI1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output VIRTUAL1 --off) &

# start the panel
tint2 &

# load wallpaper
(sleep 1 && nitrogen --restore) &

# conky 
(sleep 1 && conky -c /home/me/.config/conky/ArchLabs.conkyrc) &

I arrived at the sleep values by trial and error

If I remove any of the sleep values I get various other ‘wrong’ behaviours like conky in from edge of screen, mirrored monitors, offset or not full-screen wallpapers etc, depending on which sleeps I remove

I have some questions:

  1. Why do I need these sleeps?

  2. Why do I need these specific sleeps (e.g. no sleep required for tint2, why cant I remove the conky or nitrogen or xrandr ones?)

  3. Does the order of the entries in the autostart file make any difference?

Thanks

3 Likes

Nice setup:)

2 Likes

Openbox lauches a shell session (“sh”) to execute user autostart script. (read the code) Since all commands in autostart are put in background, there’s no guarantee that the commands will be executed and completed in order. Therefore, the order and a small delay in autostart try to allow the execution and completion in order. (no guarantee, either). The order & the delay value depend on how you want your Openbox session to start up and the nature of the command (some take longer than others).

In your case, you could try to move tint2 to the last to start.

4 Likes

Thanks!
That makes it much clearer.
Any indications on what takes a long time and what doesnt?

Moving tint2 to end helped :slight_smile:

1 Like

Conky can take a while. Usually for openbox, I set the wallpaper first and it should not require a sleep interval. Then conky with 2 seconds, and finally tint2 without a sleep interval. If it’s still causing some problems, load conky after tint2 with a longer sleep. Conky is usually the culprit.

On my dual monitor system, I have the xrandr setting in ~/.xprofile. That way the monitors are set when you log into X before the window manager starts. No sleep required for xrandr in .xprofile.

7 Likes

Thanks!

I didnt know about .xprofile :blush:
I put the monitors in there (still needed 1s delay there though), and noticed that there was also a nitrogen entry there as well so I commented it out.

In autostart I now have: the following and it all works like a dream - the startup is much quicker and in fact the bottleneck now is the time it takes my old monitor to fire up :smiley:

I did still need the delay on nitrogen though

# required for xfce settings to work
xfsettingsd &

# Monitors (in ~/.xprofile)
#(sleep 1 && xrandr --output eDP1 --mode 1366x768 --pos 277x1080 --rotate norma>

# load wallpaper (commented out in ~/.xprofile)
(sleep 1 && nitrogen --restore) &

# conky
(sleep 1 && conky -c /home/me/.config/conky/ArchLabs.conkyrc) &

# start the panel
tint2 &
1 Like