Skip to content

Commit 5884296

Browse files
committed
building a simple menu-based mail client
1 parent d75ec14 commit 5884296

File tree

3 files changed

+40
-12
lines changed

3 files changed

+40
-12
lines changed

curmail

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
11
#!/bin/sh
22
rm ~/.mblaze/seq*
3-
cd ~/Maildir/cur/
4-
nr=$(ls | tail -n 250 | msort -r | mseq -S | mscan -f "%-3n %c%u%r %10d <span fgcolor=\"darkcyan\">%17f</span> ICON %2i%s" | ~/dotfiles/mblaze2pango.sh | rofi -matching glob -tokenize -i -no-sort -no-levenshtein-sort -p "Mail" -markup -markup-rows -dmenu | cut -d " " -f 1)
3+
#cd ~/Maildir/cur/
4+
lists=$(ls -d ~/Maildir/.Lists* | tr '\n' ' ')
5+
DATETHRESHOLD=$(date --date="3 months ago" +%s)
6+
for maildir in ~/Maildir $lists; do
7+
case $maildir in
8+
*CorporaList*|Siks*)
9+
#noisy lists I don't really care about
10+
;;
11+
*)
12+
[ $(stat --format="%X" $maildir/new) -gt $DATETHRESHOLD ] &&\
13+
ls $maildir/new | tail -n 250 | grep ",S=" | sed "s|^|$maildir/new |" >> ~/.mblaze/seq_pre
14+
[ $(stat --format="%X" $maildir/cur) -gt $DATETHRESHOLD ] &&\
15+
ls $maildir/cur | tail -n 250 | grep ",S=" | sed "s|^|$maildir/cur |" >> ~/.mblaze/seq_pre
16+
;;
17+
esac
18+
done
19+
cat ~/.mblaze/seq_pre | sort -rk 2 | head -n 1000 | sed "s| |/|" > ~/.mblaze/seq
20+
nr=$(mseq | mscan -f "%-3n %c%u%r %10d <span fgcolor=\"darkcyan\">%17f</span> ICON %2i%s" | ~/dotfiles/mblaze2pango.sh | rofi -matching glob -tokenize -i -no-sort -no-levenshtein-sort -p "Mail" -markup -markup-rows -dmenu -click-to-exit | cut -d " " -f 1)
21+
#nr=$(find ~/Maildir/cur/ -ctime -14 | tail -n 250 | msort -r | mseq -S | mscan -f "%-3n %c%u%r %10d <span fgcolor=\"darkcyan\">%17f</span> ICON %2i%s" | ~/dotfiles/mblaze2pango.sh | rofi -matching glob -tokenize -i -no-sort -no-levenshtein-sort -p "Mail" -markup -markup-rows -dmenu | cut -d " " -f 1)
522
if [ -n "$nr" ]; then
623
ATTACHDIR=~/Downloads/mailattachments
724
rm -rf "$ATTACHDIR"

mblaze2pango.sh

+20-9
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,34 @@
22
while read -r line; do
33
nr=$(echo "$line" | cut -d " " -f 1)
44
remainder=$(echo "$line" | cut -d " " -f 2-)
5-
color=white
5+
color="#fbf1c7"
66
icon=" "
77
case "$line" in
8-
*"Registration request from"*)
8+
*"Registration request from"*|*"build success"*|*"build fail"*|*Siksleden*|*Corpora-List*|*Nieuwsbrief*|*Newsletter*|*Correspondent*|*Steam*)
99
color=gray
1010
;;
1111
*"[PATCH"*)
1212
color=HotPink
1313
;;
14+
*"TO:"*)
15+
color=green
16+
;;
17+
esac
18+
case "$line" in
19+
*"TO:"*)
20+
icon=👉
21+
;;
1422
*"frog"*)
1523
icon=🐸
1624
;;
1725
*"folia"*)
1826
icon=🥬
1927
;;
20-
*"TO:"*)
21-
icon=👉
22-
color=green
28+
*"clam"*)
29+
icon=🐚
30+
;;
31+
*"sxmo"*)
32+
icon=📱
2333
;;
2434
*)
2535
from=$(maddr -h from "$nr")
@@ -40,13 +50,16 @@ while read -r line; do
4050
*anaxotic*|*van-gompel*)
4151
icon=👪
4252
;;
53+
*debian.org*|*alpinelinux.org*)
54+
icon=🐧
55+
;;
4356
*github.com*)
4457
color=HotPink
45-
icon=
58+
icon=🎫
4659
;;
4760
*sr.ht*)
4861
color=HotPink
49-
icon=
62+
icon=🎫
5063
;;
5164
*noreply*|*homeautomation*)
5265
color=gray
@@ -55,6 +68,4 @@ while read -r line; do
5568
;;
5669
esac
5770
echo "$nr <span fgcolor=\"$color\">$remainder</span>" | sed "s/ ICON / $icon /" | sed 's/Re:/<span fgcolor="green">Re:<\/span>/i' | sed 's/Fwd:/<span fgcolor="blue">Fwd:<\/span>/i'
58-
59-
6071
done

muttrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ tag-transforms "inbox" "📥" \
246246
"folia" "🥬" \
247247
"flat" "🥬" \
248248
"ci" "🤖" \
249-
"sysadmin" "💻" \
249+
"sysadmin" "🎠" \
250250
"homeautomation" "🏡" \
251251
"lamachine" "🦙" \
252252
"university" "🎓" \

0 commit comments

Comments
 (0)