summary refs log tree commit diff
diff options
context:
space:
mode:
-rwxr-xr-x.config/waybar/modules/timetracked.sh13
1 files changed, 11 insertions, 2 deletions
diff --git a/.config/waybar/modules/timetracked.sh b/.config/waybar/modules/timetracked.sh
index 4963ea0..52611a3 100755
--- a/.config/waybar/modules/timetracked.sh
+++ b/.config/waybar/modules/timetracked.sh
@@ -1,10 +1,19 @@
 #!/bin/sh
 
 set -e
+[ -n "$DEBUG" ] && set -x
+
+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'
-
+		jq -c 'if .project == "---" then {} else { text: (["▶", .trackedTimeToday] | join(" ")), class: "timetracked", alt: "timetracked" } end' 2>/dev/null
 	sleep 30
 done