From 9a11a00e4fe2f41a59c5abd0cbb2ae05f9de7e4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Fri, 19 Aug 2022 11:27:17 +0200 Subject: [PATCH] feat(i3status-rust): add todo count --- lib/i3status-rust.nix | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lib/i3status-rust.nix b/lib/i3status-rust.nix index dfa7a02..537ce2e 100644 --- a/lib/i3status-rust.nix +++ b/lib/i3status-rust.nix @@ -69,6 +69,7 @@ in { net_wired = "🌐"; net_wireless = "📶"; pomodoro = "🍅 "; + tasks = "✅"; time = "📅 "; toggle_off = "👎"; toggle_on = "👍"; @@ -90,6 +91,32 @@ in { block = "custom"; interval = 10; command = "newsboat-unread-count"; + json = true; + } + { + block = "custom"; + interval = 10; + command = pkgs.writers.writeDash "todo" '' + ${pkgs.todoman}/bin/todo --porcelain | ${pkgs.jq}/bin/jq -r ' + map(select(.due != null)) + | (map(select(.due < now)) | length) as $overdue + | (map(select(.due >= now and .due < now + (60 * 60 * 24))) | length) as $dueToday + | { + icon: "tasks", + text: "\($overdue)+\($dueToday)", + state: ( + if $overdue > 0 then + "Critical" + elif $dueToday == 0 then + "Good" + else + "Info" + end + ) + } + ' + ''; + json = true; } { block = "weather";