diff --git a/common/.local/libexec/statusbar/sb-task b/common/.local/libexec/statusbar/sb-task new file mode 100755 index 00000000..946a8cae --- /dev/null +++ b/common/.local/libexec/statusbar/sb-task @@ -0,0 +1,26 @@ +#!/bin/sh +. libsb + +icon= + +get_context() { + task context show | awk "NR==1 { gsub(\"'\", \"\"); print \$2 }" +} + +get_active() { + num_active=$(task export active | jq length) + + [ "$num_active" = 0 ] && { + echo "No active task" + return + } + + [ "$num_active" -gt 1 ] && { + echo "$num_active active tasks" + return + } + + task export active | jq -r '.[0].description' +} + +printf "%s %s: %s\n" "$icon" "$(get_context)" "$(get_active)"