summary refs log tree commit diff
path: root/.config/waybar
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2022-02-09 00:21:38 +0100
committerRobert Günzler <r@gnzler.io>2022-02-09 00:21:38 +0100
commit83fca9b77fb5ff5cbf9e793e156b9d976a252961 (patch)
treebc8f4ea435fa39610e170f9bc6dee21f818f3000 /.config/waybar
parentcb44bd26ff25fad88b811ad39f434c0144d012aa (diff)
waybar: add timetrace module
Diffstat (limited to '.config/waybar')
-rw-r--r--.config/waybar/config.jsonc9
-rwxr-xr-x.config/waybar/modules/timetracked.sh10
-rw-r--r--.config/waybar/style.css6
-rw-r--r--.config/waybar/style.css.in6
4 files changed, 30 insertions, 1 deletions
diff --git a/.config/waybar/config.jsonc b/.config/waybar/config.jsonc
index 4d3fdaf..7736710 100644
--- a/.config/waybar/config.jsonc
+++ b/.config/waybar/config.jsonc
@@ -39,7 +39,7 @@
 
   // ------------------------------------------------------------------------ //
 
-  "modules-center": ["custom/weather", "clock#local", "clock#utc", "custom/toggl"],
+  "modules-center": ["custom/weather", "clock#local", "clock#utc", "custom/timetracked"],
 
   "custom/weather": {
     "format": "{icon} {percentage}℃",
@@ -90,6 +90,13 @@
     "return-type": "json"
   },
 
+  "custom/timetracked": {
+    "format": "{}",
+    "exec": "$HOME/.config/waybar/modules/timetracked.sh",
+    "escape": true,
+    "return-type": "json"
+  },
+
   // ------------------------------------------------------------------------ //
   "modules-right": ["tray", "cpu", "memory", "disk#root", "disk#home", "temperature", "idle_inhibitor", "backlight", "custom/gamma", "pulseaudio", "network#mullvad", "network#tailscale", "network", "battery"],
 
diff --git a/.config/waybar/modules/timetracked.sh b/.config/waybar/modules/timetracked.sh
new file mode 100755
index 0000000..4963ea0
--- /dev/null
+++ b/.config/waybar/modules/timetracked.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+
+while true; do
+	timetrace status -o json |
+		jq -c 'if .project == "---" then {} else { text: (["󰔛", .trackedTimeToday] | join(" ")), class: "timetracked", alt: "timetracked" } end'
+
+	sleep 30
+done
diff --git a/.config/waybar/style.css b/.config/waybar/style.css
index 2d6a36c..eb2810e 100644
--- a/.config/waybar/style.css
+++ b/.config/waybar/style.css
@@ -59,6 +59,7 @@ window#waybar.hidden {
 #custom-mpris,
 #custom-todo,
 #custom-covid,
+#custom-timetracked,
 #tray {
   /* border-top: 1px solid @dimmeddarker; */
   padding: 0 0.1rem;
@@ -252,6 +253,11 @@ label:focus {
   background: @urgent;
 }
 
+#custom-timetracked {
+  color: @urgent;
+  border-top: 1px solid @urgent;
+}
+
 @keyframes flash {
   50% {
     background: rgba(255,174,66, 0.7);
diff --git a/.config/waybar/style.css.in b/.config/waybar/style.css.in
index 67a1001..5735bef 100644
--- a/.config/waybar/style.css.in
+++ b/.config/waybar/style.css.in
@@ -59,6 +59,7 @@ window#waybar.hidden {
 #custom-mpris,
 #custom-todo,
 #custom-covid,
+#custom-timetracked,
 #tray {
   /* border-top: 1px solid @dimmeddarker; */
   padding: 0 0.1rem;
@@ -252,6 +253,11 @@ label:focus {
   background: @urgent;
 }
 
+#custom-timetracked {
+  color: @urgent;
+  border-top: 1px solid @urgent;
+}
+
 @keyframes flash {
   50% {
     background: rgba(255,174,66, 0.7);