diff --git a/.dotter/global.toml b/.dotter/global.toml index 4b5c9bd..e695c82 100644 --- a/.dotter/global.toml +++ b/.dotter/global.toml @@ -62,6 +62,9 @@ pass = "~" "office/.config/aerc/accounts.conf" = { target = "~/.config/aerc/accounts.conf", type = "template" } "office/.config/aerc/Personal.qmap" = { target = "~/.config/aerc/Personal.qmap", type = "template" } "office/.config/notmuch/default/hooks/post-new" = { target = "~/.config/notmuch/default/hooks/post-new", type = "template" } +"office/.config/neomutt/account" = { target = "~/.config/neomutt/account", type = "template" } +"office/.config/neomutt/profile.gmail" = { target = "~/.config/neomutt/profile.gmail", type = "template" } +"office/.config/neomutt/profile.private" = { target = "~/.config/neomutt/profile.private", type = "template" } office = "~" [services.files] diff --git a/office/.config/aerc/accounts.conf b/office/.config/aerc/accounts.conf index 6da73d9..1e68aa4 100644 --- a/office/.config/aerc/accounts.conf +++ b/office/.config/aerc/accounts.conf @@ -4,7 +4,7 @@ maildir-store = ~/documents/mail query-map = ~/.config/aerc/Personal.qmap default = Inbox folders-sort = Inbox,Drafts,Sent -check-mail-cmd = mail-sync +check-mail-cmd = neomutt-syncmail exclude-tags = spam multi-file-strategy = act-dir-delete-rest restrict-delete = true diff --git a/office/.config/aerc/binds.conf b/office/.config/aerc/binds.conf index 1a2d6a4..a33819f 100644 --- a/office/.config/aerc/binds.conf +++ b/office/.config/aerc/binds.conf @@ -118,8 +118,8 @@ s = :split S = :vsplit # send mails to taskwarrior -,t = :pipe -s -m mail-totask -c -d -t -,T = :pipe -s -m mail-totask -c +,t = :pipe -s -m neomutt-2task -c -d -t +,T = :pipe -s -m neomutt-2task -c # # TODO: Investigate use # pl = :patch list diff --git a/office/.config/goimapnotify/goimapnotify.yaml b/office/.config/goimapnotify/goimapnotify.yaml index 5cc6b21..32ca462 100644 --- a/office/.config/goimapnotify/goimapnotify.yaml +++ b/office/.config/goimapnotify/goimapnotify.yaml @@ -8,4 +8,5 @@ configurations: passwordCMD: "{{#if mail_personal_password_cmd}}{{mail_personal_password_cmd}}{{/if}}" boxes: - mailbox: INBOX - onNewMail: mail-sync personal-inbox + onNewMail: neomutt-syncmail personal-inbox + onNewMailPost: 'notify-send "Incoming mail"' diff --git a/office/.config/neomutt/account b/office/.config/neomutt/account new file mode 100644 index 0000000..6714331 --- /dev/null +++ b/office/.config/neomutt/account @@ -0,0 +1,15 @@ +# Account settings +# local maildir settings +set mbox_type = Maildir +set folder = ~/documents/mail # This has the shortcut '+' or '= ' +set spool_file = "+Inbox" # This has the shortcut '!' +set postponed = "+Drafts" +set record = "+Sent" +set trash = "+Trash" +mailboxes -notify -poll ! \ + -poll "+Archive" \ + -poll "+Jobs" \ + -poll "+Receipts" \ + -nonotify -nopoll "+Junk" \ + -nonotify -nopoll "+Sent" \ + diff --git a/office/.config/neomutt/colors b/office/.config/neomutt/colors new file mode 100644 index 0000000..9d0fd4c --- /dev/null +++ b/office/.config/neomutt/colors @@ -0,0 +1,207 @@ +# # taken from https://gideonwolfe.com/posts/workflow/neomutt/intro/ +# # Header colors: +color header blue default ".*" +color header brightmagenta default "^(From)" +color header brightcyan default "^(Subject)" +color header brightwhite default "^(CC|BCC)" + +color body brightred default "[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+" # Email addresses +color body brightblue default "(https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+" # URL +color body green default "\`[^\`]*\`" # Green text between ` and ` +color body brightblue default "^# \.*" # Headings as bold blue +color body brightcyan default "^## \.*" # Subheadings as bold cyan +color body brightgreen default "^### \.*" # Subsubheadings as bold green +color body yellow default "^(\t| )*(-|\\*) \.*" # List items as yellow +color body brightcyan default "[;:][-o][)/(|]" # emoticons +color body brightcyan default "[;:][)(|]" # emoticons +color body brightcyan default "[ ][*][^*]*[*][ ]?" # more emoticon? +color body brightcyan default "[ ]?[*][^*]*[*][ ]" # more emoticon? +color body red default "(BAD signature)" +color body cyan default "(Good signature)" +color body brightblack default "^gpg: Good signature .*" +color body brightyellow default "^gpg: " +color body brightyellow red "^gpg: BAD signature from.*" +mono body bold "^gpg: Good signature" +mono body bold "^gpg: BAD signature from.*" +color body red default "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]" + +# Default index colors: +color index yellow default "~A" +color index_author magenta default "~A" +color index_number blue default "~A" +color index_subject cyan default "~A" + +# For new mail (i.e. arrived after last time neomutt was open): +color index brightyellow default "~N" +color index_author bold italic brightred default "~N" +color index_subject bold italic brightcyan default "~N" + +# For unread mail: +color index brightyellow default "~U" +color index_author bold brightmagenta brightblack "~U" +color index_subject underline brightcyan default "~U" + +color progress black cyan +# Nerd icons idea based on https://github.com/sheoak/neomutt-powerline-nerdfonts/ +# Dracula colors based on Dracula Theme by Paul Townsend + + +# Formatting ---------------------------------------------------------------------- +set date_format = "%a %d %h %H:%M" +set index_format=" %zc %zs %zt | %-20.20L %?X?& ? %M %-30.100s %> %?Y?%Y ? %(!%a %d %h %H:%M) %B" +set pager_format="%n %T %s%*  %{!%d %b · %H:%M} %?X? %X?%P" +set status_format = " %D %?u? %u ?%?R? %R ?%?d? %d ?%?t? %t ?%?F? %F ?%?p? %p? \n \n" +set compose_format="-- NeoMutt: Compose [Approx. msg size: %l Atts: %a]%>-" +# set vfolder_format = "%N %?n?%3n& ? %8m  · %f" +set attach_format = "%u%D  %T %-75.20d %T  %5s %m/%M" +set sidebar_format = '%D%%* %%S' +index-format-hook attachment_info '=B text/calendar ~X 1' ' ' +index-format-hook attachment_info '=B text/calendar' " " +index-format-hook attachment_info '~X 1' " " +index-format-hook attachment_info '~A' " " + + +# General Colors ------------------------------------------------------------------ +color normal default default # general text +color error color231 color212 # error messages +color message default default # messages at the bottom +color prompt default default # prompt text +color search black color10 # search highlight + + +# Statusbar Colors ---------------------------------------------------------------- +color status color141 default +color status color7 color8 '([a-zA-Z0-9\.,]|\[|\])(\s)' # bubble content 1 +color status color7 color8 '(\s)([a-zA-Z0-9\.,]|\[|\])' # bubble content 2 +color status color7 color8 '(\% )' # % symbol +color status color7 color8 '(\S)' # empty spaces +color status color8 default '(|)' # statusline "bubbles" +color status color69 black '(\` )' # bubble account variation +color status white color69 '([a-zA-Z0-9\.]+)( )' # account text +color status green color8 '' # Unread messages count +color status blue color8 '' # Read messages count icon +color status yellow color8 '' # Flagged icon +color status red color8 '' # Pending delete icon + + +# Index Colors -------------------------------------------------------------------- +color index color15 default '~N' # new messages +color index color8 default '~R' # read messages +color index color8 default '~Q' # messages which have been replied to +color index_collapsed color4 default # collapsed thread (message count text) +color index color5 default '!~Q^~p' # sent only to me and haven't been replied to +color index color22 default '~h X-Label..' # messages with a complete label +color index color6 default '~F' # flagged messages +color index color6 default '~F~N' # flagged messages (new) +color index color14 default '~F~R' # flagged messages (read) +color index color1 default '~D' # deleted messages +color index color1 default '~D~N' # deleted messages (new) +color index color9 default '~D~R' # deleted messages (read) +color index color3 default '~T' # tagged messages +color index color3 default '~T~N' # tagged messages (new) +color index color11 default '~T~R' # tagged messages (read) +color tree color8 color8 # thread tree lines/arrow +color indicator black cyan # selection indicator +color index_date color8 default # date is always the same colour +color index_label color6 default # label is always the same colour + + +# Sidebar Colors ------------------------------------------------------------------ +color sidebar_indicator color14 black # currently selected mailbox +color sidebar_highlight white color8 # highlighted, but not open, mailbox. +color sidebar_ordinary color8 default # Color to give mailboxes by default +color sidebar_divider color8 black # divider between sidebar & content +color sidebar_flagged red black # mailboxes containing flagged mail +color sidebar_new green black # mailboxes containing new mail +color sidebar_unread color7 default # mailboxes containing unread mail + + +# Message Headers ----------------------------------------------------------------- +color hdrdefault color8 default + + +# Message Body -------------------------------------------------------------------- + +# Attachments +color attachment color8 default + +# Signature +color signature color8 default + +# emails +color body color14 default '[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+' + +# hide "mailto" +color body color0 color0 '' + +# URLs +color body color3 default '(https?|ftp)://[-\.,/%~_:?&=\#a-zA-Z0-9\+]+' + +# Dividers +color body color8 default '(^[-_]*$)' + +# Important info in calendar invites +color body color6 default '^(Date\/Time|Location|Organiser|Invitees|Teams Meeting)(:| \~\~)' + +# Quotes +color quoted color61 default +color quoted1 color117 default +color quoted2 color84 default +color quoted3 color215 default +color quoted4 color212 default + +# Forward/reply headers +color body color8 default '(^(To|From|Sent|Subject):.*)' + +# Patch syntax highlighting +# color body brightwhite default '^[[:space:]].*' +# color body yellow default ^(diff).* +# color body white default ^[\-\-\-].* +# color body white default ^[\+\+\+].* +# color body green default ^[\+].* +# color body red default ^[\-].* +# color body brightblue default [@@].* +# color body cyan default ^(Signed-off-by).* +# color body brightwhite default ^(Cc) +# color body yellow default "^diff \-.*" +# color body brightwhite default "^index [a-f0-9].*" +# color body brightblue default "^---$" +# color body white default "^\-\-\- .*" +# color body white default "^[\+]{3} .*" +# color body green default "^[\+][^\+]+.*" +# color body red default "^\-[^\-]+.*" +# color body brightblue default "^@@ .*" +# color body green default "LGTM" +# color body brightmagenta default "-- Commit Summary --" +# color body brightmagenta default "-- File Changes --" +# color body brightmagenta default "-- Patch Links --" +# color body green default "^Merged #.*" +# color body red default "^Closed #.*" +# color body brightblue default "^Reply to this email.*" + + +# Misc ----------------------------------------------------------------------------- + +# no addressed to me, to me, group, cc, sent by me, mailing list +set to_chars=" " + +# unchanged mailbox, changed, read only, attach mode +set status_chars = " 󱫄" +ifdef crypt_chars set crypt_chars = " " +set flag_chars = " " + +# hide some tags +set hidden_tags = "unread,draft,flagged,passed,replied,attachment,signed,encrypted" +tag-transforms "replied" "↻ " \ + "encrytpted" "" \ + "signed" "" \ + "attachment" "󰁦" \ + +# The formats must start with 'G' and the entire sequence is case sensitive. +tag-formats "replied" "GR" \ + "encrypted" "GE" \ + "signed" "GS" \ + "attachment" "GA" \ + + # don't put '+' at the beginning of wrapped lines +set markers=no diff --git a/office/.config/neomutt/keys/bind b/office/.config/neomutt/keys/bind new file mode 100644 index 0000000..a4ffd65 --- /dev/null +++ b/office/.config/neomutt/keys/bind @@ -0,0 +1,214 @@ +bind generic,index,editor,pager,compose help +set abort_key = "" # overwrite default, frankly insane, combination + +# NOTE: For operations where message/thread are both possible: +# Generally the lower-case letter will operate on the WHOLE thread +# while the upper-case letter will operate on a specific message in the thread. +# e.g. t -> tag thread / T -> tag message +# dd -> delete thread / dD -> delete message + +# go 'back' with h but only close the app with q +bind index,pager,attach,browser,query,alias,compose q exit +bind pager,attach,browser,query,alias,compose h exit + +# view manipulation +bind attach,browser,index,pager \CF next-page +bind attach,browser,index,pager \CB previous-page +bind attach,browser,index,pager \Cu half-up +bind attach,browser,index,pager \Cd half-down +bind browser,index,pager \Ce next-line +bind browser,index,pager \Cy previous-line +bind index zz current-middle +bind index zt current-top +bind index zb current-bottom + +# line navigation +bind index,attach,browser,query G last-entry +bind index,attach,browser,query gg first-entry +bind pager G bottom +bind pager gg top +bind attach,browser,query,compose j next-entry +bind attach,browser,query,compose k previous-entry +bind index j next-undeleted +bind index k previous-undeleted +bind pager j next-line +bind pager k previous-line +bind index,pager \Cn next-entry +bind index,pager \Cp previous-entry + +# tagging +macro index J "tag current and select next entry" +macro index K ":set resolve=no:set resolve=yes" "tag current and select previous entry" +macro index t ":set resolve=no:set resolve=yes" "tag current thread" +macro index T ":set resolve=no:set resolve=yes" "tag current entry" + +# # flagging +# bind index,pager ,F modify-labels +# bind index,pager ,fc clear-flag +# bind index,pager ,\cf clear-flag +# bind index,pager ,ff flag-message +# bind index ,fs toggle-new # can't toggle new WHILE reading a msg +# macro index ,S "T~UN." "mark all messages as read" +# bind index,pager ,fl edit-label # set X-Label Header +# # Saner copy/move dialogs +# macro index,pager ,c "?" "copy a message to a mailbox" +# macro index,pager ,m "?" "move thread to a mailbox" +# macro index,pager ,M "?" "move a message to a mailbox" + +# sorting +bind index s sort-mailbox +bind index S sort-reverse + +# threads +macro index l "" "display message" +macro index "" "display message" +bind index h collapse-thread +bind index collapse-thread # TODO: Remove in favor of learning za? +bind pager,index + link-threads +bind pager,index - break-thread +bind pager,index gt next-thread # TODO: overwritten by go to trash +bind pager,index gT previous-thread +bind pager,index za collapse-thread +bind pager,index zA collapse-all +bind pager,index zr reconstruct-thread +bind pager,index zR entire-thread + +# message manipulation +bind index,pager dD delete-message +bind index,pager dd delete-thread +bind index,pager dt delete-subthread +bind index,pager u undelete-thread +bind index,pager U undelete-message +# TODO: Figure out +# macro index D ";:set resolve=no!=Archiveecho 'Message deleted':set resolve=yes" "Quick Delete" +# macro index A ";:set resolve=no!=Archiveecho 'Message archived':set resolve=yes" "Quick Archive" + +# search navigation +bind generic,index,attach,browser,pager n search-next # next result +bind generic,index,attach,browser,pager N search-opposite # previous result +bind generic,index / search +bind generic,index ? search-reverse +bind index,alias,query \C_ limit # ^/ to search and limit +bind index \\ vfolder-from-query # notmuch search +macro index / "all\n" "show all messages (undo limit)" +bind index ,/ show-limit + +# sidebar and folders +macro index,pager f "?" "change folder" +macro index,pager F "?" "change virtual folder" +bind browser,query select-entry +bind browser,query l select-entry +bind index,pager e sidebar-toggle-visible # TODO: or map to L? +bind index,pager E sidebar-toggle-virtual +bind index,pager e sidebar-open +bind index,pager ] sidebar-next +bind index,pager [ sidebar-prev +bind index,pager } sidebar-next-new +bind index,pager { sidebar-prev-new + +# message functions +# send to editor or send to editor with ALL headers etc +macro index,pager h "nvim '+setlocal buftype=nofile'" "send message to editor" +bind index,pager H view-raw-message +bind index,pager H display-toggle-weed +bind index,pager v view-attachments +bind index,pager,attach,compose | pipe-message + +# reading a message +bind pager ,q toggle-quoted + +# editor +bind editor backward-char +bind editor forward-char +bind editor \cb backward-char +bind editor \cf forward-char +bind editor \ca bol +bind editor \ce eol +bind editor \cw kill-word +bind editor \cu kill-line +bind editor history-up +bind editor history-down +bind editor \cp history-up +bind editor \cn history-down +bind editor \cr history-search + +# address book functions +bind editor complete-query +bind editor \ct complete +# add contact to Khard address book +macro index,pager ,a \ + "khard add-email" \ + "add the sender email address to khard" + +# sending +bind index,pager mm mail +bind index,pager mM recall-message # edit last from drafts +bind index,pager,attach mr group-reply # answer all +bind index,pager,attach mR reply # answer SINGLE person +bind index,pager,attach mf forward-message + +# composing +bind compose y send-message +bind compose e edit-message +bind compose p print-entry +bind compose P postpone-message +bind compose ,t edit-to +bind compose ,y edit-type +bind compose ,f edit-from +bind compose ,s edit-subject +bind compose ,c edit-cc +bind compose ,b edit-bcc +bind compose ,p edit-fcc +bind compose c pgp-menu +bind compose r rename-file +bind compose | filter-entry # TODO: figure out the difference to pipe-entry +bind compose K move-up +bind compose J move-down +macro compose a 'source "neomutt-filer attach"|' "Attach with file manager" +bind compose d edit-description +bind compose D detach-file +bind compose l view-attach +bind compose view-attach +bind compose t tag-entry +bind compose gg group-alternatives +bind compose gr group-related +bind compose gl group-multilingual +bind compose gu ungroup-attachment + +# manage attachments +macro attach s 'source "neomutt-filer saveto ~/downloads"|' "Save attachment to dir" +bind attach view-mailcap +bind attach l view-mailcap + +# mailbox navigation +macro index,pager gi "Inbox" "go to inbox" +macro index,pager gs "Sent" "go to sent" +macro index,pager gd "Drafts" "go to drafts" +macro index,pager gt "Trash" "go to trash" +macro index,pager ga "Archive" "go to archive" +macro index,pager gr "Receipts" "go to receipts" +macro index,pager gj "Jobs" "go to jobs" + +#### Misc functions and macros + +# Refresh far imap email +macro index,pager O "export MBSYNC_PRE=true; neomutt-syncmail" "refresh all e-mail" + +# Send mail to taskwarrior +macro index,pager ,t "neomutt-2task -c -d -t" "add mail to taskwarrior" +macro index,pager ,T "neomutt-2task -c" "quickadd mail to taskwarrior" + +# Write (djot-flavored) markdown and instantly transform it into a TXT/HTML result +# HTML-enabled email readers display that and others can still enjoy a txt representation +macro compose ,m \ + "set pipe_decode\ + pandoc -f gfm -t plain -o /tmp/msg.txt\ + pandoc -s -f gfm --standalone --embed-resources -o /tmp/msg.html --template email\ + unset pipe_decode\ + /tmp/msg.txt\ + /tmp/msg.html\ + " \ + "Convert markdown to HTML5 and plaintext alternative content types" + +# # open urls found in the e-mail +# macro index,pager \CU " unset pipe_decodeextract_url | fzf | clip" "get URLs" diff --git a/office/.config/neomutt/keys/unbind b/office/.config/neomutt/keys/unbind new file mode 100644 index 0000000..0c71e1f --- /dev/null +++ b/office/.config/neomutt/keys/unbind @@ -0,0 +1,263 @@ +# Unbind everything.. the defaults suck balls and do crazy things + +bind generic,pager,editor,index,compose,browser,attach | noop +bind generic,pager,editor,index,compose,browser,attach a noop +bind generic,pager,editor,index,compose,browser,attach b noop +bind generic,pager,editor,index,compose,browser,attach c noop +bind generic,pager,editor,index,compose,browser,attach d noop +bind generic,pager,editor,index,compose,browser,attach e noop +bind generic,pager,editor,index,compose,browser,attach f noop +bind generic,pager,editor,index,compose,browser,attach g noop +bind generic,pager,editor,index,compose,browser,attach h noop +bind generic,pager,editor,index,compose,browser,attach i noop +bind generic,pager,editor,index,compose,browser,attach j noop +bind generic,pager,editor,index,compose,browser,attach k noop +bind generic,pager,editor,index,compose,browser,attach l noop +bind generic,pager,editor,index,compose,browser,attach m noop +bind generic,pager,editor,index,compose,browser,attach n noop +bind generic,pager,editor,index,compose,browser,attach o noop +bind generic,pager,editor,index,compose,browser,attach p noop +bind generic,pager,editor,index,compose,browser,attach r noop +bind generic,pager,editor,index,compose,browser,attach s noop +bind generic,pager,editor,index,compose,browser,attach t noop +bind generic,pager,editor,index,compose,browser,attach u noop +bind generic,pager,editor,index,compose,browser,attach v noop +bind generic,pager,editor,index,compose,browser,attach w noop +bind generic,pager,editor,index,compose,browser,attach x noop +bind generic,pager,editor,index,compose,browser,attach y noop +bind generic,pager,editor,index,compose,browser,attach z noop +bind generic,pager,editor,index,compose,browser,attach A noop +bind generic,pager,editor,index,compose,browser,attach B noop +bind generic,pager,editor,index,compose,browser,attach C noop +bind generic,pager,editor,index,compose,browser,attach D noop +bind generic,pager,editor,index,compose,browser,attach E noop +bind generic,pager,editor,index,compose,browser,attach F noop +bind generic,pager,editor,index,compose,browser,attach G noop +bind generic,pager,editor,index,compose,browser,attach H noop +bind generic,pager,editor,index,compose,browser,attach I noop +bind generic,pager,editor,index,compose,browser,attach J noop +bind generic,pager,editor,index,compose,browser,attach K noop +bind generic,pager,editor,index,compose,browser,attach L noop +bind generic,pager,editor,index,compose,browser,attach M noop +bind generic,pager,editor,index,compose,browser,attach N noop +bind generic,pager,editor,index,compose,browser,attach O noop +bind generic,pager,editor,index,compose,browser,attach P noop +bind generic,pager,editor,index,compose,browser,attach Q noop +bind generic,pager,editor,index,compose,browser,attach R noop +bind generic,pager,editor,index,compose,browser,attach S noop +bind generic,pager,editor,index,compose,browser,attach T noop +bind generic,pager,editor,index,compose,browser,attach U noop +bind generic,pager,editor,index,compose,browser,attach V noop +bind generic,pager,editor,index,compose,browser,attach W noop +bind generic,pager,editor,index,compose,browser,attach X noop +bind generic,pager,editor,index,compose,browser,attach Y noop +bind generic,pager,editor,index,compose,browser,attach Z noop + +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,index,compose,browser,attach noop +bind generic,pager,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop + +bind generic,pager,editor,index,compose,browser,attach 1 noop +bind generic,pager,editor,index,compose,browser,attach 2 noop +bind generic,pager,editor,index,compose,browser,attach 3 noop +bind generic,pager,editor,index,compose,browser,attach 4 noop +bind generic,pager,editor,index,compose,browser,attach 5 noop +bind generic,pager,editor,index,compose,browser,attach 6 noop +bind generic,pager,editor,index,compose,browser,attach 7 noop +bind generic,pager,editor,index,compose,browser,attach 8 noop +bind generic,pager,editor,index,compose,browser,attach 9 noop +bind generic,pager,editor,index,compose,browser,attach 0 noop +bind generic,pager,editor,index,compose,browser,attach ! noop +bind generic,pager,editor,index,compose,browser,attach @ noop +bind generic,pager,editor,index,compose,browser,attach $ noop +bind generic,pager,editor,index,compose,browser,attach % noop +bind generic,pager,editor,index,compose,browser,attach ^ noop +bind generic,pager,editor,index,compose,browser,attach & noop +bind generic,pager,editor,index,compose,browser,attach * noop +bind generic,pager,editor,index,compose,browser,attach ( noop +bind generic,pager,editor,index,compose,browser,attach ) noop + +bind generic,pager,editor,index,compose,browser,attach \Ca noop +bind generic,pager,editor,index,compose,browser,attach \Cb noop +bind generic,pager,editor,index,compose,browser,attach \Cc noop +bind generic,pager,editor,index,compose,browser,attach \Cd noop +bind generic,pager,editor,index,compose,browser,attach \Ce noop +bind generic,pager,editor,index,compose,browser,attach \Cf noop +bind generic,pager,editor,index,compose,browser,attach \Cg noop +bind generic,pager,editor,index,compose,browser,attach \Ch noop +bind generic,pager,editor,index,compose,browser,attach \Ci noop +bind generic,pager,editor,index,compose,browser,attach \Cj noop +bind generic,pager,editor,index,compose,browser,attach \Ck noop +bind generic,pager,editor,index,compose,browser,attach \Cl noop +bind generic,pager,editor,index,compose,browser,attach \Cm noop +bind generic,pager,editor,index,compose,browser,attach \Cn noop +bind generic,pager,editor,index,compose,browser,attach \Co noop +bind generic,pager,editor,index,compose,browser,attach \Cp noop +bind generic,pager,editor,index,compose,browser,attach \Cq noop +bind generic,pager,editor,index,compose,browser,attach \Cr noop +bind generic,pager,editor,index,compose,browser,attach \Cs noop +bind generic,pager,editor,index,compose,browser,attach \Ct noop +bind generic,pager,editor,index,compose,browser,attach \Cv noop +bind generic,pager,editor,index,compose,browser,attach \Cw noop +bind generic,pager,editor,index,compose,browser,attach \Cxe noop +bind generic,pager,editor,index,compose,browser,attach \Cx noop +bind generic,pager,editor,index,compose,browser,attach \Cy noop +bind generic,pager,editor,index,compose,browser,attach \Cz noop +bind generic,pager,editor,index,compose,browser,attach \CA noop +bind generic,pager,editor,index,compose,browser,attach \CB noop +bind generic,pager,editor,index,compose,browser,attach \CC noop +bind generic,pager,editor,index,compose,browser,attach \CD noop +bind generic,pager,editor,index,compose,browser,attach \CE noop +bind generic,pager,editor,index,compose,browser,attach \CF noop +bind generic,pager,editor,index,compose,browser,attach \CG noop +bind generic,pager,editor,index,compose,browser,attach \CH noop +bind generic,pager,editor,index,compose,browser,attach \CI noop +bind generic,pager,editor,index,compose,browser,attach \CJ noop +bind generic,pager,editor,index,compose,browser,attach \CK noop +bind generic,pager,editor,index,compose,browser,attach \CL noop +bind generic,pager,editor,index,compose,browser,attach \CM noop +bind generic,pager,editor,index,compose,browser,attach \CN noop +bind generic,pager,editor,index,compose,browser,attach \CO noop +bind generic,pager,editor,index,compose,browser,attach \CP noop +bind generic,pager,editor,index,compose,browser,attach \CQ noop +bind generic,pager,editor,index,compose,browser,attach \CR noop +bind generic,pager,editor,index,compose,browser,attach \CS noop +bind generic,pager,editor,index,compose,browser,attach \CT noop +bind generic,pager,editor,index,compose,browser,attach \CV noop +bind generic,pager,editor,index,compose,browser,attach \CW noop +bind generic,pager,editor,index,compose,browser,attach \CX noop +bind generic,pager,editor,index,compose,browser,attach \CY noop +bind generic,pager,editor,index,compose,browser,attach \CZ noop + +bind generic,pager,editor,index,compose,browser,attach \C noop +bind generic,pager,editor,index,compose,browser,attach \C noop +bind generic,pager,editor,index,compose,browser,attach \C noop +bind generic,pager,editor,index,compose,browser,attach \C noop +bind generic,pager,editor,index,compose,browser,attach \C noop +bind generic,pager,editor,index,compose,browser,attach \C noop +bind generic,pager,editor,index,compose,browser,attach \C noop +bind generic,pager,editor,index,compose,browser,attach \C noop +bind generic,pager,editor,index,compose,browser,attach \C noop +bind generic,pager,editor,index,compose,browser,attach \C noop +bind generic,pager,editor,index,compose,browser,attach \C noop +bind generic,pager,editor,index,compose,browser,attach \C noop +bind generic,pager,editor,index,compose,browser,attach \C noop +bind generic,pager,editor,index,compose,browser,attach \C noop + +bind generic,pager,editor,index,compose,browser,attach \C1 noop +bind generic,pager,editor,index,compose,browser,attach \C2 noop +bind generic,pager,editor,index,compose,browser,attach \C3 noop +bind generic,pager,editor,index,compose,browser,attach \C4 noop +bind generic,pager,editor,index,compose,browser,attach \C5 noop +bind generic,pager,editor,index,compose,browser,attach \C6 noop +bind generic,pager,editor,index,compose,browser,attach \C7 noop +bind generic,pager,editor,index,compose,browser,attach \C8 noop +bind generic,pager,editor,index,compose,browser,attach \C9 noop +bind generic,pager,editor,index,compose,browser,attach \C0 noop +bind generic,pager,editor,index,compose,browser,attach \C! noop +bind generic,pager,editor,index,compose,browser,attach \C$ noop +bind generic,pager,editor,index,compose,browser,attach \C% noop +bind generic,pager,editor,index,compose,browser,attach \C^ noop +bind generic,pager,editor,index,compose,browser,attach \C& noop +bind generic,pager,editor,index,compose,browser,attach \C* noop +bind generic,pager,editor,index,compose,browser,attach \C( noop +bind generic,pager,editor,index,compose,browser,attach \C) noop + +bind generic,pager,editor,index,compose,browser,attach a noop +bind generic,pager,editor,index,compose,browser,attach b noop +bind generic,pager,editor,index,compose,browser,attach c noop +bind generic,pager,editor,index,compose,browser,attach d noop +bind generic,pager,editor,index,compose,browser,attach e noop +bind generic,pager,editor,index,compose,browser,attach f noop +bind generic,pager,editor,index,compose,browser,attach g noop +bind generic,pager,editor,index,compose,browser,attach h noop +bind generic,pager,editor,index,compose,browser,attach i noop +bind generic,pager,editor,index,compose,browser,attach j noop +bind generic,pager,editor,index,compose,browser,attach k noop +bind generic,pager,editor,index,compose,browser,attach l noop +bind generic,pager,editor,index,compose,browser,attach m noop +bind generic,pager,editor,index,compose,browser,attach n noop +bind generic,pager,editor,index,compose,browser,attach o noop +bind generic,pager,editor,index,compose,browser,attach p noop +bind generic,pager,editor,index,compose,browser,attach q noop +bind generic,pager,editor,index,compose,browser,attach r noop +bind generic,pager,editor,index,compose,browser,attach s noop +bind generic,pager,editor,index,compose,browser,attach t noop +bind generic,pager,editor,index,compose,browser,attach u noop +bind generic,pager,editor,index,compose,browser,attach v noop +bind generic,pager,editor,index,compose,browser,attach w noop +bind generic,pager,editor,index,compose,browser,attach x noop +bind generic,pager,editor,index,compose,browser,attach y noop +bind generic,pager,editor,index,compose,browser,attach z noop +bind generic,pager,editor,index,compose,browser,attach A noop +bind generic,pager,editor,index,compose,browser,attach B noop +bind generic,pager,editor,index,compose,browser,attach C noop +bind generic,pager,editor,index,compose,browser,attach D noop +bind generic,pager,editor,index,compose,browser,attach E noop +bind generic,pager,editor,index,compose,browser,attach F noop +bind generic,pager,editor,index,compose,browser,attach G noop +bind generic,pager,editor,index,compose,browser,attach H noop +bind generic,pager,editor,index,compose,browser,attach I noop +bind generic,pager,editor,index,compose,browser,attach J noop +bind generic,pager,editor,index,compose,browser,attach K noop +bind generic,pager,editor,index,compose,browser,attach L noop +bind generic,pager,editor,index,compose,browser,attach M noop +bind generic,pager,editor,index,compose,browser,attach N noop +bind generic,pager,editor,index,compose,browser,attach O noop +bind generic,pager,editor,index,compose,browser,attach P noop +bind generic,pager,editor,index,compose,browser,attach Q noop +bind generic,pager,editor,index,compose,browser,attach R noop +bind generic,pager,editor,index,compose,browser,attach S noop +bind generic,pager,editor,index,compose,browser,attach T noop +bind generic,pager,editor,index,compose,browser,attach U noop +bind generic,pager,editor,index,compose,browser,attach V noop +bind generic,pager,editor,index,compose,browser,attach W noop +bind generic,pager,editor,index,compose,browser,attach X noop +bind generic,pager,editor,index,compose,browser,attach Y noop +bind generic,pager,editor,index,compose,browser,attach Z noop + +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop +bind generic,pager,editor,index,compose,browser,attach noop + +bind generic,pager,editor,index,compose,browser,attach 1 noop +bind generic,pager,editor,index,compose,browser,attach 2 noop +bind generic,pager,editor,index,compose,browser,attach 3 noop +bind generic,pager,editor,index,compose,browser,attach 4 noop +bind generic,pager,editor,index,compose,browser,attach 5 noop +bind generic,pager,editor,index,compose,browser,attach 6 noop +bind generic,pager,editor,index,compose,browser,attach 7 noop +bind generic,pager,editor,index,compose,browser,attach 8 noop +bind generic,pager,editor,index,compose,browser,attach 9 noop +bind generic,pager,editor,index,compose,browser,attach 0 noop +bind generic,pager,editor,index,compose,browser,attach ! noop +bind generic,pager,editor,index,compose,browser,attach @ noop +bind generic,pager,editor,index,compose,browser,attach $ noop +bind generic,pager,editor,index,compose,browser,attach % noop +bind generic,pager,editor,index,compose,browser,attach ^ noop +bind generic,pager,editor,index,compose,browser,attach & noop +bind generic,pager,editor,index,compose,browser,attach * noop +bind generic,pager,editor,index,compose,browser,attach ( noop +bind generic,pager,editor,index,compose,browser,attach ) noop diff --git a/office/.config/neomutt/mailcap b/office/.config/neomutt/mailcap new file mode 100644 index 0000000..123dda9 --- /dev/null +++ b/office/.config/neomutt/mailcap @@ -0,0 +1,33 @@ +# open html emails in browser (or whatever GUI program is used to render HTML) +text/html; open %s ; nametemplate=%s.html +# render html emails inline using magic (uncomment the line below to use lynx instead) +# text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -collapse_br_tags -dump %s; nametemplate=%s.html; copiousoutput +text/html; neomutt-renderhtml %s; nametemplate=%s.html; copiousoutput; +text/plain; $EDITOR %s ; + +# show calendar invites +text/calendar; mutt-ics; description=ics details; copiousoutput; print=khal import %s; needsterminal +application/ics; mutt-ics; description=ics details; copiousoutput; print=khal import %s; needsterminal + +# open images externally +image/*; imv %s ; + +# open videos in mpv +video/*; mpv --autofit-larger=90\%x90\% %s; needsterminal; +video/*; setsid mpv --quiet %s &; copiousoutput + +# open spreadsheets in sc-im +application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; sc-im %s; needsterminal + +# documents +application/pdf; pdftotext -layout %s -; copiousoutput; print=open %s +application/msword; pandoc --from docx --to plain %s; copiousoutput +application/vnd.openxmlformats-officedocument.wordprocessingml.document; pandoc --from odt --to plain %s; copiousoutput +application/rtf; pandoc --from rtf --to plain %s; copiousoutput + + +application/pgp-encrypted; gpg -d '%s'; copiousoutput; +application/pgp-keys; gpg --import '%s'; copiousoutput; + +# open anything else externally +application/*; mkdir -p /tmp/mutt \; cp %s /tmp/mutt \; open /tmp/mutt/$(basename %s) & diff --git a/office/.config/neomutt/neomuttrc b/office/.config/neomutt/neomuttrc new file mode 100644 index 0000000..202bfc0 --- /dev/null +++ b/office/.config/neomutt/neomuttrc @@ -0,0 +1,71 @@ +source colors +source settings + +source keys/unbind +source keys/bind + +source account + +################## notmuch settings +# index notmuch on start and exit +startup-hook "`command -v notmuch && notmuch new 2>/dev/null`" +shutdown-hook "`command -v notmuch && notmuch new 2>/dev/null`" +# whenever changing directory fetch changes +folder-hook notmuch:// "push 'notmuch new >/dev/null'" + +set nm_query_type = "threads" +set nm_exclude_tags = "spam" +set nm_record = yes +set nm_record_tags = "-inbox,archive" +virtual-mailboxes "Inbox" "notmuch://?query=folder:Inbox" \ + "Unread" "notmuch://?query=tag:unread" \ + "Archive" "notmuch://?query=folder:Archive" \ + "Drafts" "notmuch://?query=folder:Drafts" \ + "Sent" "notmuch://?query=folder:Sent" \ + "Jobs" "notmuch://Jobs?query=folder:Jobs" \ + "Receipts" "notmuch://?query=folder:Receipts" \ + "Junk" "notmuch://?query=folder:Junk" \ + "github" "notmuch://?query=tag:github" \ + "bemoji" "notmuch://?query=tag:bemoji"\ + "All" "notmuch://?query=*"\ + "Trash" "notmuch://?query=folder:Trash" \ + +push 'Inbox' + +virtual-mailboxes "date/" "notmuch://?query=date:today.."\ + " this week" "notmuch://?query=date:week.."\ + " this month" "notmuch://?query=date:month.." + +virtual-mailboxes "attach/" "notmuch://?query=attachment:\.%20not%20attachment:\.pdf"\ + " with PDF" "notmuch://?query=attachment:\.pdf"\ + " with JPG" "notmuch://?query=attachment:\.jpg%20or%20attachment:\.png" + +# bind index,pager S modify-labels # allow +adding -removing !toggling any notmuch tags +# macro index,pager f "+flagged" "Toggle flagged tag" +# +# macro index,pager ,ff "!flaggednotmuch new" "toggle flag" +macro index,pager ,ff "!flagged" "toggle flag" +macro index,pager ,fi "+inbox" "send to inbox" +macro index,pager R " '+trashnotmuch new'" "send to trash" + + +bind index,pager w modify-labels +# macro index A "+archive -unread -inbox" +# macro index I "-inbox -unread" +# macro index S "" + +tag-transforms "unread" "U" +tag-formats "inbox" "GI" \ + "flagged" "GF" \ + "unread" "GU" \ + "test" "Gt" \ + +color index_tags red black +set index_format="%zc %zs %zt | %-20.20L %?X?& ? %M %-30.100s %* %?GF?%GF ? %(!%a %d %h %H:%M)" + +# conditional dates, showing "09:48" for today's msg, "Mon 27 Aug" for this year's msg, +# "22 Dec '24" for previous years +# set index_format="%-30.100s %* %<[y?%<[d?%[%H:%M]&%[%a %d %h]>&%[%d %h \'%y]>" + + +# - [ ] show 'Inbox' etc in index IF we are in query results diff --git a/office/.config/neomutt/profile.gmail b/office/.config/neomutt/profile.gmail new file mode 100644 index 0000000..b7fd46f --- /dev/null +++ b/office/.config/neomutt/profile.gmail @@ -0,0 +1,2 @@ +color status color3 black '(\` )' # bubble account variation +macro generic ":source ~/.config/neomutt/profile.private" diff --git a/office/.config/neomutt/profile.private b/office/.config/neomutt/profile.private new file mode 100644 index 0000000..34ef5fe --- /dev/null +++ b/office/.config/neomutt/profile.private @@ -0,0 +1,2 @@ +color status color69 black '(\` )' # bubble account variation +macro generic ":source ~/.config/neomutt/profile.gmail" diff --git a/office/.config/neomutt/settings b/office/.config/neomutt/settings new file mode 100644 index 0000000..1eb3413 --- /dev/null +++ b/office/.config/neomutt/settings @@ -0,0 +1,128 @@ +set mail_check = 60 +set mail_check_stats + +# at least for rapid prototyping +set quit +# no pause for info messages +set sleep_time = 0 +# mark read (not just seen) after +set pager_read_delay = 1 +# get rid of headers when passing messages along +set pipe_decode +# apply commands to all tagged messages automatically +set auto_tag +# dont wait for user input after shell cmds, auto-view, piping, etc +set wait_key = no +# dont pre-process mail for ~b/~B searches +set thorough_search = no +# make it impossible to delete flagged mails +set flag_safe + +################### Pager settings +# filetypes and mailcap +set mailcap_path = "~/.config/neomutt/mailcap:~/.mailcap:/usr/share/neomutt/mailcap:/etc/mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap" +# Consult mime.types for determining types of these attachments +mime_lookup application/octet-stream +# This requires a ~/.mailcap entry with the copiousoutput flag, such as: +# text/html; lynx -dump -width ${COLUMNS:-80} %s; nametemplate=%s.html; copiousoutput +auto_view application/ics +auto_view text/calendar +auto_view text/plain +auto_view text/html +# Prefer plain text to html but multipart to plain for those only sending that +alternative_order text/calendar application/ics text/plain text/enriched text/html multipart/mixed multipart/related text/plain text/* + +# look for attachments also in multipart/alternatives +set count_alternatives = yes +# AFAIK we do not have to manually ensure dir existence +set header_cache= "~/.cache/neomutt/hcache/" +# recommended https://github.com/neomutt/neomutt/issues/3259#issuecomment-1043693471 +set header_cache_backend = "lmdb" +set header_cache_compress_method = "lz4" +set header_cache_compress_level = 9 + +################### Compose settings +# allow editing headers while writing mail +set edit_headers +# separate signature from mail +set sig_dashes +# automatically fill in from and subject for replies +set fast_reply +# subject for forwarding +set forward_format = "Fwd: %s" +# default send back to reply-to: header instead of from: header +set reply_to +# default to reply as person e-mail was originally sent to +set reverse_name +# include original msg in reply +set include +# include original msg as quote in fwd +set forward_quote +# forward attachments with mail +set mime_forward = no +# attachments saved with body +set fcc_attach +# we use mimeo in this house +set mime_type_query_command = "mimeo -m" +# send settings +set sendmail = "/usr/bin/msmtp" +set sendmail_wait = 10 +# spellchecker +set ispell = "enchant-2 -a" + +################## Display Settings +# allow escape codes for color etc +set allow_ansi +# thread based on the regexes below +set reply_regex = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*" +set quote_regex = "^( {0,4}[>|:#%]| {0,4}[A-Za-z0-9]+[>|]+)+" +#### Thread ordering +set use_threads=reverse +set sort='last-date' +set sort_aux = date +set collapse_all = yes +set uncollapse_new = no +set thread_received = yes +set narrow_tree = yes + +# sidebar view options +set sidebar_width = 20 +set sidebar_visible = no +set sidebar_component_depth = 0 +set sidebar_divider_char = '│' +set sidebar_next_new_wrap = yes +set sidebar_sort = 'unsorted' +# Shorten mailbox names +set sidebar_short_path = yes +# Delete everything up to the last / character +set sidebar_delim_chars="/" +# Indent folders whose names we've shortened +set sidebar_folder_indent = yes +# Indent with two spaces +# set sidebar_indent_string = ' - ' +set sidebar_indent_string=" " + +# statusbar view options +set status_chars = " *%A" +# pager view options +set pager_index_lines = 10 +set pager_context = 3 +# do not go to next msg if at bottom of pager +set pager_stop +set menu_scroll = yes +# show tildes for blank lines +set tilde +# no + markers if a line goes off-screen +unset markers +set wrap = 100 +# hide headers except for those explicitly unignored +ignore * +unignore From To Cc Bcc Date Subject Message-ID +unhdr_order * +unignore From To Cc Bcc Date Subject Message-ID + +# TODO: Remove stderr ignore when khard fixes its deprecation warnings +# https://github.com/lucc/khard/issues/335 +set query_command = "khard email --parsable --search-in-source-files '%s' 2>/dev/null" +# Makes notmuch return threads rather than messages +set nm_query_type = "threads" diff --git a/office/.local/bin/mail-totask b/office/.local/bin/neomutt-2task similarity index 92% rename from office/.local/bin/mail-totask rename to office/.local/bin/neomutt-2task index 3e329e0..71fc583 100755 --- a/office/.local/bin/mail-totask +++ b/office/.local/bin/neomutt-2task @@ -5,9 +5,9 @@ Creates a new task with corresponding description and tags. Description and tags can be supplied via commandline through `-d` and `-t` options, or interactively by using the options without supplying a string for them. E.g.: -`mail-totask` => task: Reply to from -`mail-totask -d "hello" -t one two` => task: hello +one +two -`mail-totask -d -t` => asks you interactively for description and tags +`mutt2task` => task: Reply to from +`mutt2task -d "hello" -t one two` => task: hello +one +two +`mutt2task -d -t` => asks you interactively for description and tags """ import argparse diff --git a/office/.local/bin/neomutt-filer b/office/.local/bin/neomutt-filer new file mode 100755 index 0000000..02f6105 --- /dev/null +++ b/office/.local/bin/neomutt-filer @@ -0,0 +1,73 @@ +#!/usr/bin/env bash +# A simple utility script for neomutt to use your favorite cli +# file manager to work with files in neomutt. +# Can add attachments to emails or save attachments in a chosen directory. +# +# Use it as `neomutt-filer attach ` +# or `neomutt-filer saveto ` +# +# Can be bound to neomutt macros like the following: +# +# macro compose A 'source "neomutt-filer attach"|' "Attach with file manager" +# macro attach S 'source "neomutt-filer saveto"|' "Save attachment to dir" +# +# read more at the following GH issues: +# https://github.com/neomutt/neomutt/issues/1515 -- switch folders with external program +# https://github.com/neomutt/neomutt/issues/1669 -- attach files with fzf + +_file_picker() { + if command -v vifm >/dev/null 2>&1; then + vifm --choose-files - "$@" + # yazi & ranger untested + elif command -v yazi >/dev/null 2>&1; then + yazi "$@" --chooser-file - + elif command -v ranger >/dev/null 2>&1; then + ranger --choosefiles - "$@" + elif command -v fzf >/dev/null 2>&1; then + fzf -m --prompt='Choose one/multiple file(s) to attach >' "$@" + fi +} +_dir_picker() { + if command -v vifm >/dev/null 2>&1; then + vifm --choose-dir - --on-choose exit "$@" + # yazi & ranger untested + # elif command -v yazi >/dev/null 2>&1; then + # yazi "$@" --chooser-file - + # elif command -v ranger >/dev/null 2>&1; then + # ranger --choosefiles - "$@" + elif command -v fzf >/dev/null 2>&1; then + find "$@" -type d -print | fzf --prompt='Choose dir >' + fi +} + +attachfile() { + _file_picker "$@" | + while IFS=$'\n' read -r attachment; do + printf "push '%s'\n" "$attachment" + done +} + +savetodir() { + _dir_picker "$@" | xargs printf "push '%sy'\n" +} + +_usage() { + echo """ +Usage: neomutt-filer [options...] +Subcommands: + attach Pick files to attach + saveto Pick a directory to save into + """ +} + +case "${1:-}" in +attach) + shift + attachfile "$@" + ;; +saveto) + shift + savetodir "$@" + ;; +-h | --help | *) _usage ;; +esac diff --git a/office/.local/bin/mail-renderhtml b/office/.local/bin/neomutt-renderhtml similarity index 93% rename from office/.local/bin/mail-renderhtml rename to office/.local/bin/neomutt-renderhtml index 0289a61..9d4a7a0 100755 --- a/office/.local/bin/mail-renderhtml +++ b/office/.local/bin/neomutt-renderhtml @@ -3,7 +3,7 @@ # requires: html2text, glow or bat # author: CEUK -fpath=$(mktemp --suffix=-mail-render.html) +fpath=$(mktemp --suffix=-neomutt-render.html) #shellcheck disable=SC2064 # we want to expand it instantly trap "rm -f -- ${fpath@Q}" EXIT diff --git a/office/.local/bin/mail-sync b/office/.local/bin/neomutt-syncmail similarity index 100% rename from office/.local/bin/mail-sync rename to office/.local/bin/neomutt-syncmail diff --git a/office/README.md b/office/README.md index 725c646..44c70a7 100644 --- a/office/README.md +++ b/office/README.md @@ -1,6 +1,6 @@ # office module -aerc - terminal mail client +neomutt - terminal mail client [mbsync](https://isync.sourceforge.io/mbsync.html) - mirror your Imapped mail directory locally with two-way synchronization [notmuch](https://notmuchmail.org/) - index and search your mail msmtp - send mail through shell commands @@ -16,11 +16,11 @@ Take care that most of the credential/account setup of course is highly specific ## mail The current mail setup uses `mbsync` (from the isync project) to locally mirror the GMail imap folder. -It is run through a `mail-sync` script which can invoke pre- and post-sync hooks +It is run through a `neomutt-syncmail` script which can invoke pre- and post-sync hooks (e.g. run your incoming mail through filters as soon as they arrive or ingest them into full-text search engines).[^1] The sync script also automatically unlocks any pass directory so that credentials can be put into their respective applications and the directory closes again after use. -`msmtp` is used for mail sending by aerc (and git if using git send-email). -`aerc` then picks up the mail directory filled by `mbsync` and lets you browse it, respond to mail or create new ones. +`msmtp` is used for mail sending by neomutt (and git if using git send-email). +`neomutt` then picks up the mail directory filled by `mbsync` and lets you browse it, respond to mail or create new ones. [^1]: That being said, the script is a little dusty and could probably use a little overhaul. It *works* but could be more fantastic I feel.