1
0
mirror of https://github.com/kmein/niveum synced 2026-03-19 11:31:09 +01:00

feat(i3status-rust): move mail setup to notmuch

This commit is contained in:
Kierán Meinhardt
2020-09-24 19:16:51 +02:00
parent bf4defbc29
commit 676a76ea16

View File

@@ -1,5 +1,7 @@
{ pkgs, wifi-interface, colours, batteryBlock }: { pkgs, wifi-interface, colours, batteryBlock }:
let let
inherit (pkgs) lib;
setsid = script: setsid = script:
pkgs.writers.writeDash "setsid-command" '' pkgs.writers.writeDash "setsid-command" ''
${pkgs.utillinux}/bin/setsid ${script} ${pkgs.utillinux}/bin/setsid ${script}
@@ -102,19 +104,13 @@ in {
{ {
block = "custom"; block = "custom";
interval = 30; interval = 30;
command = pkgs.writers.writeDash "mail-new" '' command =
for dir in /home/kfm/mail/*/Inbox/new let query = "tag:unread";
do in pkgs.writers.writeDash "count-new-mail" ''
new_mail="$(find "$dir" -type f | wc --lines)" mail_count="$(${pkgs.notmuch}/bin/notmuch search ${lib.escapeShellArg query} | wc -l)"
[ "$new_mail" = 0 ] && printf "📭" || printf "📬" [ "$mail_count" = 0 ] && printf "📭" || printf "📬"
echo "$new_mail" echo "$mail_count"
done | paste --serial --delimiters=" " - '';
'';
on_click = pkgs.writers.writeDash "mail-update" ''
${pkgs.libnotify}/bin/notify-send --app-name="📧 MBSync" "Updating email." \
&& ${pkgs.isync}/bin/mbsync --all \
&& ${pkgs.libnotify}/bin/notify-send --app-name="📧 MBSync" "Email updated."
'';
} }
{ {
block = "net"; block = "net";