Note: this wiki is no longer maintained. If you have any questions related to this wiki, please post them on the CrunchBang forums.
autostart.sh is a script that openbox executes each time it opens. Here you can put your commands to autostart applications or execute scripts you like to run when you start the computer.
You can edit your autostart.sh directly from /home/user/.config/openbox/autostart.sh, or through the root-menu in preferences>openbox>edit autostart.sh.
Note: remember that this file is called simply “autostart” (and not “autostart.sh”) in #! 10 (Statler) and 11 (Waldorf).
The syntax of autostart.sh is actually just a list of commands from the terminal that executes at the same time.
# application_description application_command &
the first line is a comment; it actually does nothing, and is frankly quite useless for the computer, it ignores all text after a '#' but it can prove to be useful for you. If the application has a name that does not explain what it is, or you've added settings to it. You might want to write something here to remember what the command actually does. Otherwise you will have an autostart file that you do not understand.
The second line is what is actually executed, in the previous example we execute 'application_command' without options or anything else, plain and simple and it executes when the script is run.
The '&' at the end of the command indicates that it should be run in the background, what this does is allow Openbox to move on to the next command. If we just called 'application_command' (without the &) Openbox wouldn't move on to anything else until application-command had finished, which might be never.
Then you've typed the wrong command. Try typing the command in the terminal (without the '&' suffix), it should work exactly the same way in the terminal as in the autostart file.
(The only possible catch is that autostart[.sh] is run by /bin/sh not by bash. If you're trying a tricky command it might work with bash but not with sh, which is less sophisticated. Try typing sh in your terminal before running the command. If you need bash you can put the command in a script and run that instead.)
This also means that you may need to specify the full path to a script, rather than using a bash shortcut like ~ for your home folder.
Well, then it was run but not properly displayed. That means that you have to execute the program a few seconds after the rest of the script. which brings us to…
Some programs don't like to wake up at the same time as everybody else, just like some humans like to sleep longer than other people and gets grumpy if they're awakened too early, or before another program they depend on is ready. We can avoid this problem by using by the sleep invocation. This is actually a quite well-named program, it delays the execution of a command by a certain amount of time (the program sleeps before it's awakened).
# application_description and is executed 3 seconds after the script is run. (sleep 3s && application_command) &
Yes you can, just see if you can execute it successfully from the terminal and everything is fine (though if you have some big heavy bastards they will slow down the startup).
You can find most of the commands in the '/usr/bin/' folder if you need more pointers on what a program does, or you need it to perform in another way, type 'man application_command' in the terminal and see if you find something that's your cup of tea.
Test commands in the terminal first, if they work there they will probably work in your autostart file, and if they don't they are easier to debug.
Restart or re-login to your computer.
To perform the above in xfce edit the following file instead:
German Version: WIKI-DE HOWTO Programme automatisch mit Openbox starten