From d5e788418195c10f9a3e91fa26cde12c6a0cf921 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Tue, 28 Nov 2023 17:11:31 +0100 Subject: [PATCH] Manage auto start X on Archlinux --- zlogin | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) 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 +## }}}