diff --git a/zlogin b/zlogin index 2c605da..326f96f 100644 --- a/zlogin +++ b/zlogin @@ -55,10 +55,10 @@ getc () stty cooked } -## Autorun an X session with some restrictions +## Autorun an X session with some restrictions for Debian {{{ ## Set a ~/.noxorg file to work in tty only # If non-root session -if [ ${USER} != "root" ] && [ $(command -v startx) ]; then +if [ -f /etc/debian_version ] && [ ${USER} != "root" ] && [ $(command -v startx) ]; then # If it's a VC console and # no X session already launch and # no ~/.noxorg file exist @@ -74,3 +74,21 @@ if [ ${USER} != "root" ] && [ $(command -v startx) ]; then fi fi fi +## }}} +## Autorun an X session with some restrictions for Archlinux {{{ +## Set a ~/.noxorg file to work in tty only +# If non-root session +if [ -f /etc/arch-release ] && [ ${USER} != "root" ] && [ $(command -v startx) ]; then + # If it's a VC console and + # no X session already launch and + # no ~/.noxorg file exist + if [ -z "${SSH_TTY}" ] && + [ ! -f "${HOME}/.noxorg" ] && + ! pgrep --full -- "/usr/lib/xorg/Xorg|/usr/lib/Xorg" ; then + echo "No X11 session detected, starting a new one…" + `startx -- :1 vt1` + else + echo "Not in a VC console, ~/.noxorg file exists or Xorg already running…" + fi +fi +## }}}