stow_dotfiles/hyprland/.config/waybar/modules/timetracked.sh
Matthieu Fortin (CPC/CCP) 5a1cfdd5a5 hyprland and waybar
2024-09-25 15:21:04 -04:00

23 lines
411 B
Bash
Executable file

#!/bin/sh
set -e
[ -n "$DEBUG" ] && set -x
if ! command -v timetrace >/dev/null 2>&1; then
exit 0
fi
case "$1" in
on-click)
timetrace status >/dev/null && timetrace stop
exit 0
;;
*) ;;
esac
while true; do
timetrace status -o json |
jq -c 'if .project == "---" then {} else { text: (["▶", .trackedTimeToday] | join(" ")), class: "timetracked", alt: "timetracked" } end' 2>/dev/null
sleep 30
done