From 3b492fd5696130b0d0baac286c0e4c889f0f70af Mon Sep 17 00:00:00 2001 From: Swagtoy Date: Tue, 21 Oct 2025 22:34:46 -0400 Subject: [PATCH] Read XDG ~/.config directory Allows the user to store a config in XDG_CONFIG_HOME or ~/.config if unset. Signed-off-by: Swagtoy --- wgetpaste | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wgetpaste b/wgetpaste index f96ed08..9c13c27 100755 --- a/wgetpaste +++ b/wgetpaste @@ -725,6 +725,9 @@ geturl() { # read the config files load_configs() { + # XDG home ~/.config + local cfg + [[ -v XDG_CONFIG_HOME ]] && cfg=$XDG_CONFIG_HOME/ || cfg=~/.config/ if [[ ! $IGNORECONFIGS ]]; then # compatibility code local f deprecated= @@ -740,7 +743,7 @@ load_configs() { done [[ -n $deprecated ]] && echo >&2 # new locations override old ones in case they collide - for f in {/etc/,~/.}wgetpaste{.d/*,}.conf; do + for f in {/etc/,~/.,"$cfg"}wgetpaste{.d/*,}.conf; do if [[ -f $f ]]; then source "$f" || die "Failed to source $f" fi