User:NoobCp/Start X at Boot

From ArchWiki
< User:NoobCp
Revision as of 08:14, 14 April 2012 by NoobCp (talk | contribs) (Added permalink to source)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Or with a prompt:

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.' ;;

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