sx: use XDG_DATA_HOME for the authority

The authority file should not really be considered configuration data
especially in the context of backups which might want to exclude such
content.
This commit is contained in:
Earnestly 2018-07-19 14:14:54 +01:00
parent bf8652401d
commit 887df364fe
2 changed files with 15 additions and 10 deletions

6
sx
View File

@ -26,9 +26,11 @@ case $tty in
esac
cfgdir=${XDG_CONFIG_HOME:-$HOME/.config}/sx
export XAUTHORITY=${XAUTHORITY:-$cfgdir/xauthority}
datadir=${XDG_DATA_HOME:-$HOME/.local/share}/sx
mkdir -p "$cfgdir" "${XAUTHORITY%/*}"
mkdir -p "$cfgdir" "$datadir"
export XAUTHORITY=${XAUTHORITY:-$datadir/xauthority}
touch "$XAUTHORITY"
trap 'cleanup' EXIT

19
sx.1
View File

@ -26,19 +26,22 @@ used to secure
If this environment is not set then
.B sx
will create and use
.B \%XDG_CONFIG_HOME/sx/xauthority
.B \%XDG_DATA_HOME/sx/xauthority
instead while also exporting this value to
.BR XAUTHORITY .
.TP
.B XDG_CONFIG_HOME
The directory used when searching for
.I sxrc
and storing
.IR xauthority .
.IR sxrc .
.B \%HOME/.config
will be used if
.B XDG_CONFIG_HOME
is not set.
will be used if not set.
.TP
.B XDG_DATA_HOME
The directory used for storing the
.I xauthority
file.
.B \%HOME/.local/share
will be used if not set.
.SH FILES
.TP
.B XDG_CONFIG_HOME/sx/sxrc
@ -46,7 +49,7 @@ The default client started by
.BR sx .
This file must be executable.
.TP
.B XDG_CONFIG_HOME/sx/xauthority
.B XDG_DATA_HOME/sx/xauthority
The default authority used by
.B sx
if an alternative file is not provided with