diff options
author | awy <awy@awy.one> | 2025-08-18 19:17:30 +0300 |
---|---|---|
committer | awy <awy@awy.one> | 2025-08-18 19:17:30 +0300 |
commit | b3526d31b40dbdf37ea4b314c8e9aa94d39b7f8c (patch) | |
tree | f262a162e13d28f8915d09d9406f5c08f9729841 /sb-mailbox |
init
Diffstat (limited to 'sb-mailbox')
-rwxr-xr-x | sb-mailbox | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sb-mailbox b/sb-mailbox new file mode 100755 index 0000000..19478e8 --- /dev/null +++ b/sb-mailbox @@ -0,0 +1,24 @@ +#!/bin/sh + +# Displays number of unread mail and an loading icon if updating. +# When clicked, brings up `neomutt`. + +case $BLOCK_BUTTON in + 1) setsid -w -f "$TERMINAL" -e neomutt ; pkill -RTMIN+12 "${STATUSBAR:-waybar}" ;; + 2) setsid -f mailup >/dev/null && exit ;; + 3) notify-send " Mail module" "\- Shows unread mail +- Shows if syncing mail +- Left click opens neomutt +- Middle click syncs mail" ;; + 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;; +esac + +unread="$(fd . "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/ -t f | wc -l 2>/dev/null)" + +icon=$(bat /tmp/mailupdate 2>/dev/null) + +if [ "$unread" -eq 0 ]; then + [ -n "$icon" ] && echo "$icon" || exit 0 +else + echo " $unread$icon" +fi |