sx: create XAUTHORITY directory components
We need to do this in sx as neither xauth(1) or touch(1) will create the path. Requiring the user to do this would lead to additional code on their side to account for a detail that sx already controls. There is no obvious benefit for omitting this functionality.
This commit is contained in:
parent
60762a5487
commit
64038adef2
7
sx
7
sx
|
@ -4,10 +4,7 @@
|
|||
# requires fgconsole stty timeout xauth Xorg
|
||||
|
||||
# I'm willing to take advantage of errexit for this script as roughly 85% of
|
||||
# the error checking would take the form of:
|
||||
# if ! command; then
|
||||
# exit
|
||||
# fi
|
||||
# the error checking would just be exiting on command failure.
|
||||
set -o errexit
|
||||
|
||||
cleanup() {
|
||||
|
@ -46,7 +43,7 @@ esac
|
|||
cfgdir=${XDG_CONFIG_HOME:-$HOME/.config}/sx
|
||||
export XAUTHORITY=${XAUTHORITY:-$cfgdir/xauthority}
|
||||
|
||||
mkdir -p "$cfgdir"
|
||||
mkdir -p "$cfgdir" "${XAUTHORITY%/*}"
|
||||
touch "$XAUTHORITY"
|
||||
|
||||
trap 'cleanup "$pid"' EXIT
|
||||
|
|
Loading…
Reference in New Issue