From 992cf45dc92b6aba36b47b496dbb0dc443aa200f Mon Sep 17 00:00:00 2001 From: Nitroretro Date: Thu, 19 Dec 2019 22:42:54 +0200 Subject: Use $XDG_{CONFIG,DATA}_HOME in hooks Signed-off-by: Lukas Fleischer --- contrib/hooks/pre-load | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'contrib/hooks/pre-load') diff --git a/contrib/hooks/pre-load b/contrib/hooks/pre-load index 38edea0..d69fbde 100755 --- a/contrib/hooks/pre-load +++ b/contrib/hooks/pre-load @@ -7,13 +7,15 @@ # $XDG_CONFIG_HOME/calcurse/hooks/ (~/.config/calcurse/hooks/) or # ~/.calcurse/hooks/ if using ~/.calcurse. -cd "$HOME"/.calcurse/ +[ -d "$HOME/.calcurse" ] && data_dir="$HOME/.calcurse" || data_dir="${XDG_DATA_HOME:-$HOME/.local/share}/calcurse" + +cd "$data_dir" || exit # Do not do anything when synchronizing with a CalDAV server. [ -f caldav/lock ] && exit # Run the CalDAV synchronization script in the background. -if [ -d caldav -a -x "$(which calcurse-caldav)" ]; then +if [ -d caldav ] && command -v calcurse-caldav >/dev/null; then ( date="$(date +'%b %d %H:%M:%S')" echo "$date Running calcurse-caldav from the pre-load hook..." -- cgit v1.2.3-70-g09d2