summary refs log tree commit diff
path: root/.config
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2022-09-28 19:37:31 +0200
committerRobert Günzler <r@gnzler.io>2022-09-28 19:37:31 +0200
commit1bfc8f9f3620c80115ceb0ad828b4c47368b6278 (patch)
tree7530743bcc0c9e3548b363e12399a86591ef2f3c /.config
parentabcee6e67da956619192339199fdc625491fde39 (diff)
waybar: make timetracked module interactive
Diffstat (limited to '.config')
-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