diff --git a/modules/home/taskwarrior.nix b/modules/home/taskwarrior.nix index c023e33..b815b29 100644 --- a/modules/home/taskwarrior.nix +++ b/modules/home/taskwarrior.nix @@ -25,7 +25,7 @@ uda.completeRecurDue.label = "Com. Rec. Due"; uda.completeRecurWait.type = "string"; uda.completeRecurWait.label = "Com. Rec. Wait"; - sync.server.url = "http:\/\/media-server:33034"; + sync.server.url = "http:\/\/media-server:33043"; }; extraConfig = "include ${config.sops.templates."taskchamp".path}"; }; diff --git a/modules/home/taskwarrior/hooks/on-exit-sync.sh b/modules/home/taskwarrior/hooks/on-exit-sync.sh new file mode 100644 index 0000000..5bd0c18 --- /dev/null +++ b/modules/home/taskwarrior/hooks/on-exit-sync.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# This hooks script syncs task warrior to the configured task server. +# The on-exit event is triggered once, after all processing is complete. + +# Make sure hooks are enabled + +check_for_internet() { + # check for internet connectivity + nc -z 8.8.8.8 53 >/dev/null 2>&1 + if [ $? != 0 ]; then + exit 0 + fi +} + +# Count the number of tasks modified +n=0 +while read modified_task +do + n=$(($n + 1)) +done + +if (($n > 0)); then + check_for_internet + date >> ~/.local/share/task/sync_hook.log + task rc.verbose:nothing sync >> ~/.local/share/task/sync_hook.log & +fi + +exit 0