diff options
author | Nitroretro <nitroretro@protonmail.com> | 2019-12-19 22:42:54 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2019-12-23 13:16:39 -0500 |
commit | 992cf45dc92b6aba36b47b496dbb0dc443aa200f (patch) | |
tree | 98b2c499618254e4e3094b5cc673a002b24bcfe5 /contrib/hooks/pre-load | |
parent | 023ca554936148e2b5a71f93ce7b849fba98182e (diff) | |
download | calcurse-992cf45dc92b6aba36b47b496dbb0dc443aa200f.tar.gz calcurse-992cf45dc92b6aba36b47b496dbb0dc443aa200f.zip |
Use $XDG_{CONFIG,DATA}_HOME in hooks
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'contrib/hooks/pre-load')
-rwxr-xr-x | contrib/hooks/pre-load | 6 |
1 files changed, 4 insertions, 2 deletions
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..." |