From 83fca9b77fb5ff5cbf9e793e156b9d976a252961 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Wed, 9 Feb 2022 00:21:38 +0100 Subject: waybar: add timetrace module --- .config/waybar/config.jsonc | 9 ++++++++- .config/waybar/modules/timetracked.sh | 10 ++++++++++ .config/waybar/style.css | 6 ++++++ .config/waybar/style.css.in | 6 ++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100755 .config/waybar/modules/timetracked.sh (limited to '.config') 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); -- cgit 1.4.1