Launching Openbox at Login without typing “startx”
Continuing with my effort to get the maximum performance out of my Crunchbang driven EeePc, I removed Slim login manager in favour of a simple console username and password login.
The problem was that, eventhough it only takes a milisecond, having to type “startx” annoyed me, so I set about trying to find an autostart-startx at login solution.
First I created a .bash_profile in my home dir:
# ~/.bash_profile: executed by bash(1) for login shells.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/login.defs
#umask 022# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi# set PATH so it includes user’s private bin if it exists
if [ -d ~/bin ] ; then
PATH=~/bin:”${PATH}”
fi
Then added this line at the end:
if [[ -z “$DISPLAY” ]] && [[ $(tty) = /dev/tty1 ]]; then
xinit
logout
fi
Thanks to anonymous_user at Arch forums for the trick:
https://bbs.archlinux.org/viewtopic.php?pid=716438#p716438