Files
config-bash/rc.d/startx
T
xavier 55d2607035 style: Use command -v instead of which for availability checks
rc.d/anyenv, rc.d/screen, aliases.d/mc, and rc.d/startx were the last
holdouts still using `which` to check tool availability. Every other
file in rc.d/* already uses `command -v`, which doesn't depend on an
external binary being installed.
2026-08-22 00:55:55 +02:00

27 lines
634 B
Plaintext

# Auto startx depending on the VT
if [[ -z "${DISPLAY}" && $(id -u) -ge 1000 ]] ; then
TTY=$(tty)
if [ "${TTY}" == "not a tty" ]; then return; fi
if [ "${TTY/tty}" != "${TTY}" -a "$(basename "${TTY/tty}")" -le 3 ]
then
case $(tty | cut -b9-) in
1) VT=vt1 ;;
2) VT=vt2 ;;
3) VT=vt3 ;;
esac
if ( command -v ck-launch-session &> /dev/null )
then
EXEC="exec ck-launch-session"
fi
if ( command -v startx &> /dev/null )
then
${EXEC} startx 1> ~/.log/xsession-errors 2>&1 -- "${VT}"
fi
fi
fi