Difference between revisions of "User:NoobCp/Start X at Boot"

From ArchWiki
Jump to: navigation, search
(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?...")
 
m (Added permalink to source)
 
Line 1: Line 1:
 +
From: https://wiki.archlinux.org/index.php?title=Start_X_at_Boot&oldid=187286
 +
 
Or with a prompt:
 
Or with a prompt:
  

Latest revision as of 08:14, 14 April 2012

From: https://wiki.archlinux.org/index.php?title=Start_X_at_Boot&oldid=187286

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.