From 887df364fe59b036662d29d6f328117ac587d65a Mon Sep 17 00:00:00 2001 From: Earnestly Date: Thu, 19 Jul 2018 14:14:54 +0100 Subject: [PATCH] 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. --- sx | 6 ++++-- sx.1 | 19 +++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/sx b/sx index 8ccceb9..8893859 100755 --- a/sx +++ b/sx @@ -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 diff --git a/sx.1 b/sx.1 index 1d0179b..7b1286c 100644 --- a/sx.1 +++ b/sx.1 @@ -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