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 esac
cfgdir=${XDG_CONFIG_HOME:-$HOME/.config}/sx 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" touch "$XAUTHORITY"
trap 'cleanup' EXIT trap 'cleanup' EXIT

19
sx.1
View File

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