User:NoobCp/Start X at Boot

From ArchWiki
< User:NoobCp
Revision as of 08:12, 14 April 2012 by NoobCp (Talk | contribs) (Created page with "Or with a prompt: {{hc|~/.bash_profile|<nowiki> if -z $DISPLAY && ! -e /tmp/.X11-unix/X0 && (( EUID )); then while true; do read -p 'Do you want to start X?...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Or with a prompt:

~/.bash_profile
if [[ -z $DISPLAY ]] && ! [[ -e /tmp/.X11-unix/X0 ]] && (( EUID )); then
  while true; do
    read -p 'Do you want to start X? (y/n): '
    case $REPLY in
      [Yy]) exec xinit -- /usr/bin/X -nolisten tcp vt7 ;;
      [Nn]) break ;;
      *) printf '%s\n' 'Please answer y or n.' ;;
    esac
  done
fi

The user will be logged out when X is killed. In order to avoid this, remove the exec part from the script.