Rename mute to delay

This commit is contained in:
Felix Van der Jeugt 2020-01-06 21:19:58 +01:00
parent b2a8a2e648
commit 9b6c220917
No known key found for this signature in database
GPG Key ID: 58B209295023754D
3 changed files with 27 additions and 27 deletions

View File

@ -86,15 +86,15 @@ theme = "mutt"
x = toggletags spam,inbox
a = untag inbox
A = tag inbox
1 = call hooks.mute(ui,1)
2 = call hooks.mute(ui,2)
3 = call hooks.mute(ui,3)
4 = call hooks.mute(ui,4)
5 = call hooks.mute(ui,5)
6 = call hooks.mute(ui,6)
7 = call hooks.mute(ui,7)
8 = call hooks.mute(ui,8)
9 = call hooks.mute(ui,9)
1 = call hooks.delay(ui,1)
2 = call hooks.delay(ui,2)
3 = call hooks.delay(ui,3)
4 = call hooks.delay(ui,4)
5 = call hooks.delay(ui,5)
6 = call hooks.delay(ui,6)
7 = call hooks.delay(ui,7)
8 = call hooks.delay(ui,8)
9 = call hooks.delay(ui,9)
i = call hooks.spam(ui)
[[thread]]
@ -103,15 +103,15 @@ theme = "mutt"
n = nextpart
p = prevpart
u = pipeto --background selecturl
1 = call hooks.mute(ui,1)
2 = call hooks.mute(ui,2)
3 = call hooks.mute(ui,3)
4 = call hooks.mute(ui,4)
5 = call hooks.mute(ui,5)
6 = call hooks.mute(ui,6)
7 = call hooks.mute(ui,7)
8 = call hooks.mute(ui,8)
9 = call hooks.mute(ui,9)
1 = call hooks.delay(ui,1)
2 = call hooks.delay(ui,2)
3 = call hooks.delay(ui,3)
4 = call hooks.delay(ui,4)
5 = call hooks.delay(ui,5)
6 = call hooks.delay(ui,6)
7 = call hooks.delay(ui,7)
8 = call hooks.delay(ui,8)
9 = call hooks.delay(ui,9)
i = call hooks.spam(ui)
[tags]

View File

@ -1,9 +1,9 @@
#!/usr/bin/env python3
async def mute(ui, days):
async def delay(ui, days):
from datetime import date, timedelta
datestr = str(date.today() + timedelta(days=days))
await ui.apply_commandline(f'toggletags inbox,muted,muted/{datestr}')
await ui.apply_commandline(f'toggletags inbox,delay,delay/{datestr}')
async def spam(ui):
from alot.buffers import EnvelopeBuffer

View File

@ -50,9 +50,9 @@ for mid in $(notmuch search --output=messages tag:new); do
done
done
# Unmute threads with new messages
for mutetag in $(notmuch search --output=tags -- tag:muted and thread:{tag:new} | grep 'muted/'); do
notmuch tag -muted -"$mutetag" +inbox -- tag:"$mutetag" and thread:{tag:new}
# Undelay threads with new messages
for delaytag in $(notmuch search --output=tags -- tag:delay and thread:{tag:new} | grep 'delay/'); do
notmuch tag -delay -"$delaytag" +inbox -- tag:"$delaytag" and thread:{tag:new}
done
# Github notifications
@ -76,11 +76,11 @@ archive tag:github thread:{from:dependabot} \
addtag inbox "not tag:spam"
notmuch tag -new -- tag:new
# Unmute threads on their day of unmuting
# Show threads after their delay
today="$(date +'%s')"
for mutetag in $(notmuch search --output=tags tag:muted | grep 'muted/'); do
until="$(date -d "${mutetag#*/}" +'%s')"
for delaytag in $(notmuch search --output=tags tag:delay | grep 'delay/'); do
until="$(date -d "${delaytag#*/}" +'%s')"
if [ "$today" -gt "$until" ]; then
notmuch tag -muted -"$mutetag" +inbox -- tag:"$mutetag"
notmuch tag -delay -"$delay" +inbox -- tag:"$delay"
fi
done