diff --git a/bin/.local/bin/update-mail-count b/bin/.local/bin/update-mail-count new file mode 100755 index 0000000..1a28942 --- /dev/null +++ b/bin/.local/bin/update-mail-count @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +fd -t f . "$HOME/.cache/mail/waarp/INBOX/new/" | wc -l > "$HOME/.cache/mail/waarp.unreadcount" diff --git a/i3wm/.config/i3status/config b/i3wm/.config/i3status/config index cc844f0..3e6447c 100644 --- a/i3wm/.config/i3status/config +++ b/i3wm/.config/i3status/config @@ -22,6 +22,7 @@ order += "battery all" order += "volume master" order += "load" order += "cpu_usage" +order += "read_file unreadmail" order += "tztime local" wireless _first_ { @@ -70,3 +71,9 @@ disk "/" { disk "/home" { format = "  %avail (%percentage_avail)" } + +read_file unreadmail { + path = "/home/bca/.cache/mail/waarp.unreadcount" + format = " %content" + Max_characters = 10 +} diff --git a/systemd/.config/systemd/user/timers.target.wants/update-mail-count.timer b/systemd/.config/systemd/user/timers.target.wants/update-mail-count.timer new file mode 120000 index 0000000..8a14d9e --- /dev/null +++ b/systemd/.config/systemd/user/timers.target.wants/update-mail-count.timer @@ -0,0 +1 @@ +/home/bca/.config/systemd/user/update-mail-count.timer \ No newline at end of file diff --git a/systemd/.config/systemd/user/update-mail-count.service b/systemd/.config/systemd/user/update-mail-count.service new file mode 100644 index 0000000..c64c451 --- /dev/null +++ b/systemd/.config/systemd/user/update-mail-count.service @@ -0,0 +1,6 @@ +[Unit] +Description=Update mail count for display in i3status + +[Service] +Type=oneshot +ExecStart=/home/bca/.local/bin/update-mail-count diff --git a/systemd/.config/systemd/user/update-mail-count.timer b/systemd/.config/systemd/user/update-mail-count.timer new file mode 100644 index 0000000..ff02670 --- /dev/null +++ b/systemd/.config/systemd/user/update-mail-count.timer @@ -0,0 +1,11 @@ +[Unit] +Description=mail count timer + +[Timer] +OnBootSec=1m +OnUnitActiveSec=1m +Persistent=true +Unit=update-mail-count.service + +[Install] +WantedBy=timers.target