From 44cf82b1973813a6cd5cb3ac15c98a9636cc8620 Mon Sep 17 00:00:00 2001 From: Braulio Henrique Marques Souto Date: Thu, 28 Jul 2022 23:45:13 -0300 Subject: [PATCH] - Changed mw to mutt-wizard - Added new Dependencies and Optional Dependencies --- README.md | 53 +++++++------ share/mailcap | 8 +- share/mutt-wizard.muttrc | 164 +++++++++++++++++++++------------------ 3 files changed, 123 insertions(+), 102 deletions(-) diff --git a/README.md b/README.md index 7904bb5..af9e89b 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,12 @@ Specifically, this wizard: #### Dependencies -- `neomutt` - the email client. (If you are using Gentoo GNU/Linux, you will need the `sasl` use flag to be enabled) +- `neomutt` - the email client (If you are using Gentoo GNU/Linux, you will need the `sasl` use flag to be enabled). - `curl` - tests connections (required at install). - `isync` - downloads and syncs the mail (required if storing IMAP mail locally). - `msmtp` - sends the email. - `pass` - safely encrypts passwords (required at install). +- `xdg-utils` - desktop integration utilities. **Note**: There's a chance of errors if you use a slow-release distro like Ubuntu, Debian, or Mint. If you get errors in `neomutt`, install the most @@ -42,7 +43,7 @@ recent version manually or manually remove the offending lines in the config in `/usr/share/mutt-wizard/mutt-wizard.muttrc`. ```bash -git clone https://github.com/LukeSmithxyz/mutt-wizard +git clone https://github.com/brauliohms/mutt-wizard cd mutt-wizard sudo make install ``` @@ -55,34 +56,39 @@ A user of Arch-based distros can also install the current mutt-wizard release fr - `pam-gnupg` - Automatically logs you into your GPG key on login so you will never need to input your password once logged on to your system. Check the repo and directions out [here](https://github.com/cruegge/pam-gnupg). -- `lynx` - view HTML email in neomutt. +- `lynx` or `w3m` or `links2` - view HTML email in neomutt. - `notmuch` - index and search mail. Install it and run `notmuch setup`, tell - it that your mail is in `~/.local/share/mail/` (although `mw` will do this + it that your mail is in `~/.local/share/mail/` (although `mutt-wizard` will do this automatically if you haven't set notmuch up before). You can run it in mutt with ctrl-f. Run `notmuch new` to process new mail. - `abook` - a terminal-based address book. Pressing tab while typing an address to send mail to will suggest contacts that are in your abook. - `urlview` - outputs urls in mail to browser. -- `cronie` - (or any other major cronjob manager) to set up automatic mail +- `crontab` - (or any other major cronjob manager) to set up automatic mail syncing. - `mpop` - If you want to use POP protocol instead of IMAP. - +- `aspell` - GNU Aspell spell-checker. +- `dunst` - dmenu style notification. +- `feh` - Image viewer. +- `mpv` - Media file viewer (audio and videos). +- `zathura` - Pdf viewer. +- `font-awesome` - Iconic font and CSS toolkit. ## Usage -The mutt-wizard runs via the command `mw`. Once setup is complete, you'll use +The mutt-wizard runs via the command `mutt-wizard`. Once setup is complete, you'll use `neomutt` to access your mail. -- `mw -a you@email.com` -- add a new email account -- `mw -l` -- list existing accounts -- `mw -y your@email.com` -- sync an email account -- `mw -Y` -- sync all configured email accounts -- `mw -d` -- choose an account to delete -- `mw -D your@email.com` -- delete account settings without confirmation -- `mw -t 30` -- toggle automatic mailsync to every 30 minutes -- `mw -T` -- toggle mailsync without specifying minutes (default is 10) -- `mw -r` -- reorder account shortcut numbers -- `pass edit mw-your@email.com` -- revise an account's password +- `mutt-wizard -a you@email.com` -- add a new email account +- `mutt-wizard -l` -- list existing accounts +- `mutt-wizard -y your@email.com` -- sync an email account +- `mutt-wizard -Y` -- sync all configured email accounts +- `mutt-wizard -d` -- choose an account to delete +- `mutt-wizard -D your@email.com` -- delete account settings without confirmation +- `mutt-wizard -t 30` -- toggle automatic mailsync to every 30 minutes +- `mutt-wizard -T` -- toggle mailsync without specifying minutes (default is 10) +- `mutt-wizard -r` -- reorder account shortcut numbers +- `pass edit mutt-wizard-your@email.com` -- revise an account's password ### Options usable when adding an account @@ -135,9 +141,9 @@ To give you an example of the interface, here's an idea: - `pam-gnupg` - Automatically logs you into your GPG key on login, so you will never need to input your password once logged on to your system. Check the repo and directions out [here](https://github.com/cruegge/pam-gnupg). -- `lynx` - View HTML email in neomutt. +- `lynx` or `w3m` or `links2` - view HTML email in neomutt. - `notmuch` - Index and search mail. Install it and run `notmuch setup`, tell it - that your mail is in `~/.local/share/mail/` (although `mw` will do this + that your mail is in `~/.local/share/mail/` (although `mutt-wizard` will do this automatically if you haven't set notmuch up before). You can run it in mutt with ctrl-f. Run `notmuch new` to process new mail. - `abook` - A terminal-based address book. Pressing tab while typing an address @@ -146,13 +152,12 @@ To give you an example of the interface, here's an idea: ## New stuff and improvements since the original release -- `mw` is now scriptable with command-line options and can run successfully +- `mutt-wizard` is now an installed program instead of just a script needed to be kept in + your mutt folder. Is now scriptable with command-line options and can run successfully without any interaction, making it possible to deploy in a script. - `isync`/`mbsync` has replaced `offlineimap` as the backend. Offlineimap was error-prone, bloated, used obsolete Python 2 modules, and required separate steps to install the system. -- `mw` is now an installed program instead of just a script needed to be kept in - your mutt folder. - `dialog` is no longer used and the interface is simply text commands. - More autogenerated shortcuts that allow quickly moving and copying mail between boxes. @@ -167,7 +172,7 @@ To give you an example of the interface, here's an idea: - Script is POSIX sh compliant. - Error handling for the many people who don't read or follow directions. Fewer errors generally. -- Addition of a manual `man mw` +- Addition of a manual `man mutt-wizard` - Now handles POP protocol via `mpop` for those who prefer it (add an account with the `-p` option). POP configs are still generated automatically. @@ -209,7 +214,7 @@ To give you an example of the interface, here's an idea: might be other hurdles or two-factor authentication you have to jump through. Some, for example, will want you to create a separate IMAP password, etc. - `isync` is not fully UTF-8 compatible, so non-Latin characters may be garbled - (although sync should succeed). `mw` will also not auto-create mailbox + (although sync should succeed). `mutt-wizard` will also not auto-create mailbox shortcuts since it is looking for English mailbox names. I strongly recommend you to set your email language to English on your mail server to avoid these problems. diff --git a/share/mailcap b/share/mailcap index 0829b3b..03578e5 100644 --- a/share/mailcap +++ b/share/mailcap @@ -1,9 +1,9 @@ -text/plain; $EDITOR %s ; -text/html; /usr/local/lib/mutt-wizard/openfile %s ; nametemplate=%s.html +text/plain; nano %s ; +text/html; /usr/lib/mutt-wizard/openfile %s ; nametemplate=%s.html text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -dump -width=1024 %s; nametemplate=%s.html; copiousoutput; -image/*; /usr/local/lib/mutt-wizard/openfile %s ; +image/*; /usr/lib/mutt-wizard/openfile %s ; video/*; setsid mpv --quiet %s &; copiousoutput audio/*; mpv %s ; -application/pdf; /usr/local/lib/mutt-wizard/openfile %s ; +application/pdf; /usr/lib/mutt-wizard/openfile %s ; application/pgp-encrypted; gpg -d '%s'; copiousoutput; application/pgp-keys; gpg --import '%s'; copiousoutput; diff --git a/share/mutt-wizard.muttrc b/share/mutt-wizard.muttrc index 4df16a4..1ea80ef 100644 --- a/share/mutt-wizard.muttrc +++ b/share/mutt-wizard.muttrc @@ -5,8 +5,9 @@ # If you want to override any settings, set those in your muttrc. set mailcap_path = $HOME/.config/mutt/mailcap:/usr/local/share/mutt-wizard/mailcap:$mailcap_path set mime_type_query_command = "file --mime-type -b %s" -set date_format="%y/%m/%d %I:%M%p" -set index_format="%2C %Z %?X?A& ? %D %-15.15F %s (%-4.4c)" +set date_format="%y/%m/%d %H:%M" +set index_format=" %2C %zs %zc %zt %D %-28.28L %?M?(%1M)& %4cr ? %?X? &·? %s" +#set index_format="%2C %Z %?X?A& ? %D %-15.15F %s (%-4.4c)" set sort = 'reverse-date' set smtp_authenticators = 'gssapi:login' set query_command = "abook --mutt-query '%s'" @@ -27,6 +28,19 @@ auto_view text/html # automatically show html (mailcap uses lynx) auto_view application/pgp-encrypted #set display_filter = "tac | sed '/\\\[-- Autoview/,+1d' | tac" # Suppress autoview messages. alternative_order text/plain text/enriched text/html +set to_chars="" +ifdef crypt_chars set crypt_chars = " " +set flag_chars = " " + +tag-transforms "replied" "↻ " \ + "encrytpted" "" \ + "signed" "" \ + "attachment" "" \ + +tag-formats "replied" "GR" \ + "encrypted" "GE" \ + "signed" "GS" \ + "attachment" "GA" \ bind index,pager i noop bind index,pager g noop @@ -48,6 +62,7 @@ bind pager j next-line bind pager k previous-line bind pager l view-attachments bind index D delete-message +bind pager D delete-message bind index U undelete-message bind index L limit bind index h noop @@ -70,6 +85,7 @@ bind index \005 next-undeleted # Mouse wheel bind pager \031 previous-line # Mouse wheel bind pager \005 next-line # Mouse wheel bind editor complete-query +bind index \em recall-message macro index,pager gi "=INBOX" "go to inbox" macro index,pager Mi ";=INBOX" "move mail to inbox" @@ -97,7 +113,7 @@ macro index,pager Ca ";=Archive" "copy mail to archive" macro index,pager a "set my_pipe_decode=\$pipe_decode pipe_decodeabook --add-emailset pipe_decode=\$my_pipe_decode; unset my_pipe_decode" "add the sender address to abook" macro index \Cr "T~UN." "mark all messages as read" -macro index O "mw -Y" "run mw -Y to sync all mail" +macro index O "mutt-wizard -Y" "run mutt-wizard -Y to sync all mail" macro index \Cf "unset wait_keyprintf 'Enter a search term to find with notmuch: '; read x; echo \$x >~/.cache/mutt_terms~i \"\`notmuch search --output=messages \$(cat ~/.cache/mutt_terms) | head -n 600 | perl -le '@a=<>;s/\^id:// for@a;$,=\"|\";print@a' | perl -le '@a=<>; chomp@a; s/\\+/\\\\+/ for@a;print@a' \`\"" "show only messages matching a notmuch pattern" macro index A "all\n" "show all messages (undo limit)" @@ -115,74 +131,74 @@ bind index,pager \Cp sidebar-prev-new bind index,pager \Cn sidebar-next-new bind index,pager B sidebar-toggle-visible -# Default index colors: -color index yellow default '.*' -color index_author red default '.*' -color index_number blue default -color index_subject cyan default '.*' - -# New mail is boldened: -color index brightyellow black "~N" -color index_author brightred black "~N" -color index_subject brightcyan black "~N" - -# Tagged mail is highlighted: -color index brightyellow blue "~T" -color index_author brightred blue "~T" -color index_subject brightcyan blue "~T" - -# Other colors and aesthetic settings: -mono bold bold -mono underline underline -mono indicator reverse -mono error bold -color normal default default -color indicator brightblack white -color sidebar_highlight red default -color sidebar_divider brightblack black -color sidebar_flagged red black -color sidebar_new green black -color normal brightyellow default -color error red default -color tilde black default -color message cyan default -color markers red white -color attachment white default -color search brightmagenta default -color status brightyellow black -color hdrdefault brightgreen default -color quoted green default -color quoted1 blue default -color quoted2 cyan default -color quoted3 yellow default -color quoted4 red default -color quoted5 brightred default -color signature brightgreen default -color bold black default -color underline black default -color normal default default - -# Regex highlighting: -color header brightmagenta default "^From" -color header brightcyan default "^Subject" -color header brightwhite default "^(CC|BCC)" -color header blue default ".*" -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 '.*' +#color index_author red default '.*' +#color index_number blue default +#color index_subject cyan default '.*' +# +## New mail is boldened: +#color index brightyellow black "~N" +#color index_author brightred black "~N" +#color index_subject brightcyan black "~N" +# +## Tagged mail is highlighted: +#color index brightyellow blue "~T" +#color index_author brightred blue "~T" +#color index_subject brightcyan blue "~T" +# +## Other colors and aesthetic settings: +#mono bold bold +#mono underline underline +#mono indicator reverse +#mono error bold +#color normal default default +#color indicator brightblack white +#color sidebar_highlight red default +#color sidebar_divider brightblack black +#color sidebar_flagged red black +#color sidebar_new green black +#color normal brightyellow default +#color error red default +#color tilde black default +#color message cyan default +#color markers red white +#color attachment white default +#color search brightmagenta default +#color status brightyellow black +#color hdrdefault brightgreen default +#color quoted green default +#color quoted1 blue default +#color quoted2 cyan default +#color quoted3 yellow default +#color quoted4 red default +#color quoted5 brightred default +#color signature brightgreen default +#color bold black default +#color underline black default +#color normal default default +# +## Regex highlighting: +#color header brightmagenta default "^From" +#color header brightcyan default "^Subject" +#color header brightwhite default "^(CC|BCC)" +#color header blue default ".*" +#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<>\"]"