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

View File

@ -1,9 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
async def mute(ui, days): async def delay(ui, days):
from datetime import date, timedelta from datetime import date, timedelta
datestr = str(date.today() + timedelta(days=days)) 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): async def spam(ui):
from alot.buffers import EnvelopeBuffer from alot.buffers import EnvelopeBuffer

View File

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