Last active
November 23, 2021 20:54
-
-
Save vodik/9442735 to your computer and use it in GitHub Desktop.
startx alternative
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# startx | |
# Alternative, simpler startx which makes use of the XDG specification | |
# - assumes dbus is already running | |
[[ -n "$DISPLAY" ]] && exit 0 | |
[[ -z "$XDG_VTNR" ]] && exit 1 | |
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config} | |
XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache} | |
XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/run/user/$UID} | |
unset SESSION_MANAGER | |
export DISPLAY=:"$XDG_VTNR" | |
export XAUTHORITY="$XDG_RUNTIME_DIR/X11-$DISPLAY-authority" | |
touch $XAUTHORITY | |
xauth -qf "$XAUTHORITY" add "$DISPLAY" . "$(mcookie)" | |
xinitrc="$XDG_CONFIG_HOME"/xinitrc | |
log="$XDG_CACHE_HOME/xsession-$DISPLAY.log" | |
serveropts=( | |
"$DISPLAY" | |
vt"$XDG_VTNR" | |
-noreset | |
-nolisten tcp | |
-auth "$XAUTHORITY" | |
) | |
exec systemd-run --user --scope --unit="xinit-${DISPLAY}.scope" \ | |
xinit "$xinitrc" "$@" -- /usr/bin/X "${serveropts[@]}" 3>$log |
Author
vodik
commented
Mar 9, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment