From 9b6c220917a3c0836209faca6dae10812c6ebca1 Mon Sep 17 00:00:00 2001 From: Felix Van der Jeugt Date: Mon, 6 Jan 2020 21:19:58 +0100 Subject: [PATCH] Rename mute to delay --- config/alot/config | 36 ++++++++++++++++++------------------ config/alot/hooks.py | 4 ++-- notmuch-hooks/post-new | 14 +++++++------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/config/alot/config b/config/alot/config index 82bc3d5..9129d73 100644 --- a/config/alot/config +++ b/config/alot/config @@ -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] diff --git a/config/alot/hooks.py b/config/alot/hooks.py index 331d1d3..0c9d05b 100644 --- a/config/alot/hooks.py +++ b/config/alot/hooks.py @@ -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 diff --git a/notmuch-hooks/post-new b/notmuch-hooks/post-new index 03dcb62..bb0c5c8 100755 --- a/notmuch-hooks/post-new +++ b/notmuch-hooks/post-new @@ -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 \ No newline at end of file