Replace 'if (command -v x &>/dev/null); then' with 'if command -v x &>/dev/null; then' across completion.d, rc.d and profile.d. Parentheses forced a subshell fork for every 'if' check, which is unnecessary overhead since command -v runs fine in the current shell. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
27 lines
626 B
Plaintext
27 lines
626 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
|