From 4301ac900932c08e10e754a52acc51ce84ab77d1 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Wed, 28 Feb 2018 22:47:46 +1300 Subject: [PATCH 1/1] print task output on shell start only once every 30s --- .zsh/zshrc/parts.d/50-taskwarrior | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.zsh/zshrc/parts.d/50-taskwarrior b/.zsh/zshrc/parts.d/50-taskwarrior index b35e383..2cf9d38 100644 --- a/.zsh/zshrc/parts.d/50-taskwarrior +++ b/.zsh/zshrc/parts.d/50-taskwarrior @@ -16,7 +16,14 @@ if whence task >/dev/null; then alias ty='t sync' alias td='t done' - [[ -t 0 ]] && task 2>/dev/null || : + local SENTINEL=${XDG_RUNTIME_DIR}/taskwarrior/shell_run_sentinel + mkdir --parent ${SENTINEL%/*} + # only print the tasks at most once every 30 seconds + if [[ -t 0 ]] && [[ -z ${SENTINEL}(#qNms-30) ]]; then + touch ${SENTINEL} + task 2>/dev/null || : + fi + unset SENTINEL fi # vim:ft=zsh -- 2.39.5