Manage auto start X on Archlinux

This commit is contained in:
Jeremy Gardais 2023-11-28 17:11:31 +01:00
parent 5b82144876
commit d5e7884181
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 20 additions and 2 deletions

22
zlogin
View File

@ -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
## }}}