Skip to content

Instantly share code, notes, and snippets.

@nihilismus
Created May 15, 2016 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nihilismus/1d8df0b8f7432143e8618a6ecdf66c36 to your computer and use it in GitHub Desktop.
Save nihilismus/1d8df0b8f7432143e8618a6ecdf66c36 to your computer and use it in GitHub Desktop.
Execute startx automatically in a linux system (/dev/tty1 or Ctrl+Alt+F1)
#!/bin/bash
# sdm.sh : Start X **automagically** when login-in /dev/tty1
#
# Add the execution of this script, or the next lines, at the
# end of ~/.bashrc or ~/.bash_profile
TTY="$(/usr/bin/tty | sed 's:.*/::')"
if [[ ! ${DISPLAY} && ${TERM} == 'linux' && ${TTY} == 'tty1' ]]; then
unset TTY
exec startx
fi
unset TTY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment