summaryrefslogtreecommitdiff
path: root/tw/home/files
diff options
context:
space:
mode:
authorTimo Wilken2023-02-15 23:27:53 +0100
committerTimo Wilken2023-02-15 23:34:54 +0100
commitc2471f212ed2336c691af881e00932c1eb0a1b27 (patch)
tree385406c457b79af579f3a5cc3fe87d869edb2721 /tw/home/files
parent3e9777331c3d01955e1ab9eea0d9cb155c60ce7b (diff)
Use aerc for mail by default
But keep neomutt installed for now, just in case.
Diffstat (limited to 'tw/home/files')
-rw-r--r--tw/home/files/aerc/accounts.conf55
-rw-r--r--tw/home/files/aerc/aerc.conf149
-rw-r--r--tw/home/files/aerc/binds.conf159
-rwxr-xr-xtw/home/files/aerc/filters/colorize.ansi134
-rw-r--r--tw/home/files/aerc/stylesets/catppuccin36
-rw-r--r--tw/home/files/i3.conf2
6 files changed, 534 insertions, 1 deletions
diff --git a/tw/home/files/aerc/accounts.conf b/tw/home/files/aerc/accounts.conf
new file mode 100644
index 00000000..a29f1453
--- /dev/null
+++ b/tw/home/files/aerc/accounts.conf
@@ -0,0 +1,55 @@
+[Mythic Beasts]
+source = imaps://timo%40twilken.net@oncilla.mythic-beasts.com
+outgoing = smtps+plain://timo%40twilken.net@smtp-auth.mythic-beasts.com
+source-cred-cmd = pass www/mythic-beasts/email/timo | head -1
+outgoing-cred-cmd = pass www/mythic-beasts/email/timo | head -1
+default = INBOX
+from = Timo Wilken <timo@twilken.net>
+copy-to = Sent
+postpone = Drafts
+cache-headers = true
+
+[CERN]
+source = imaps+insecure://twilken@imap.cern.ch
+outgoing = smtp+login://twilken@smtp.cern.ch
+source-cred-cmd = pass cern/sso | head -1
+outgoing-cred-cmd = pass cern/sso | head -1
+default = INBOX
+smtp-starttls = yes
+from = Timo Wilken <timo.wilken@cern.ch>
+copy-to = Sent
+postpone = Drafts
+cache-headers = true
+
+[Gmail]
+source = imaps://timo.21.wilken%40gmail.com@imap.gmail.com
+outgoing = smtps+login://timo.21.wilken%40gmail.com@smtp.gmail.com
+source-cred-cmd = pass www/google/app-passwords/mutt | head -1
+outgoing-cred-cmd = pass www/google/app-passwords/mutt | head -1
+default = INBOX
+from = Timo Wilken <timo.21.wilken@gmail.com>
+copy-to = [Gmail]/Sent Mail
+postpone = [Gmail]/Drafts
+cache-headers = true
+
+[Cantab]
+source = imaps+xoauth2://tw466%40cantab.ac.uk@outlook.office365.com
+outgoing = smtps+xoauth2://tw466%40cantab.ac.uk@smtp-mail.outlook.com
+source-cred-cmd = mutt_oauth2.py --encryption-pipe='gpg --encrypt --recipient timo@twilken.net' "$XDG_DATA_HOME/neomutt/cantab.gpg"
+outgoing-cred-cmd = mutt_oauth2.py --encryption-pipe='gpg --encrypt --recipient timo@twilken.net' "$XDG_DATA_HOME/neomutt/cantab.gpg"
+default = INBOX
+from = Timo Wilken <tw466@cantab.ac.uk>
+copy-to = Sent Items
+postpone = Drafts
+cache-headers = true
+
+[Outlook]
+source = imaps+xoauth2://timo_wilken%40live.co.uk@outlook.office365.com
+outgoing = smtps+xoauth2://timo_wilken%40live.co.uk@smtp-mail.outlook.com
+source-cred-cmd = mutt_oauth2.py --encryption-pipe='gpg --encrypt --recipient timo@twilken.net' "$XDG_DATA_HOME/neomutt/outlook.gpg"
+outgoing-cred-cmd = mutt_oauth2.py --encryption-pipe='gpg --encrypt --recipient timo@twilken.net' "$XDG_DATA_HOME/neomutt/outlook.gpg"
+default = INBOX
+from = Timo Wilken <timo_wilken@live.co.uk>
+copy-to = Sent
+postpone = Drafts
+cache-headers = true
diff --git a/tw/home/files/aerc/aerc.conf b/tw/home/files/aerc/aerc.conf
new file mode 100644
index 00000000..db83c7c4
--- /dev/null
+++ b/tw/home/files/aerc/aerc.conf
@@ -0,0 +1,149 @@
+# aerc main configuration
+
+[general]
+#default-save-path=
+# Allow world-readable accounts.conf. This is fine as I don't store any
+# passwords there, only "pass" commands.
+unsafe-accounts-conf=true
+
+[ui]
+# Describes the format for each row in a mailbox view. This field is compatible
+# with mutt's printf-like syntax.
+index-format=%4C %Z %19D %-17.17n %s
+
+# See time.Time#Format at https://godoc.org/time#Time.Format
+timestamp-format=Mon _2 Jan 2006 15:04
+
+# List of space-separated criteria to sort the messages by, see *sort*
+# command in *aerc*(1) for reference. Prefixing a criterion with "-r "
+# reverses that criterion.
+sort=-r date
+
+threading-enabled=true
+
+next-message-on-delete=false
+
+sidebar-width=24
+
+styleset-name=catppuccin
+pinned-tab-marker='πŸ“Œ'
+# Use box-drawing characters for vertical and horizontal borders.
+border-char-vertical=β”‚
+border-char-horizontal=─
+# Use UTF-8 symbols to indicate PGP status of messages
+icon-unencrypted=
+icon-encrypted=πŸ”’
+icon-signed=βœ”
+icon-signed-encrypted=βœ”πŸ”’
+icon-unknown=✘
+icon-invalid=⚠
+
+# Activates fuzzy search in commands and their arguments: the typed string is
+# searched in the command or option in any position, and need not be
+# consecutive characters in the command or option.
+#fuzzy-complete=false
+
+[statusline]
+render-format=[%a %p] %S %>%T
+
+# Defines the mode for displaying the status elements.
+# Options: text, icon
+display-mode=icon
+
+[viewer]
+# Specifies the pager to use when displaying emails. Note that some filters
+# may add ANSI codes to add color to rendered emails, so you may want to use a
+# pager which supports ANSI codes.
+pager='env LESSKEYIN=/dev/null less -iRM'
+
+# If an email offers several versions (multipart), you can configure which
+# mimetype to prefer. For example, this can be used to prefer plaintext over
+# html emails.
+alternatives=text/plain,text/html
+
+# Layout of headers when viewing a message. To display multiple headers in the
+# same row, separate them with a pipe, e.g. "From|To". Rows will be hidden if
+# none of their specified headers are present in the message.
+#header-layout=From|To,Cc|Bcc,Date,Subject
+
+[compose]
+# Default header fields to display when composing a message. To display
+# multiple headers in the same row, separate them with a pipe, e.g. "To|From".
+#header-layout=To|From,Subject
+
+# Specifies the command to be used to tab-complete email addresses. Any
+# occurrence of "%s" in the address-book-cmd will be replaced with what the
+# user has typed so far.
+#
+# The command must output the completions to standard output, one completion
+# per line. Each line must be tab-delimited, with an email address occurring as
+# the first field. Only the email address field is required. The second field,
+# if present, will be treated as the contact name. Additional fields are
+# ignored.
+#
+# This parameter can also be set per account in accounts.conf.
+address-book-cmd=khard email --parsable %s
+
+# Allow to address yourself when replying
+reply-to-self=false
+
+# Warn before sending an email that matches the specified regexp but does not
+# have any attachments. Leave empty to disable this feature.
+# Uses Go's regexp syntax, documented at https://golang.org/s/re2syntax. The
+# "(?im)" flags are set by default (case-insensitive and multi-line).
+no-attachment-warning=^[^>]*(attach|Anhang|angehΓ€ngt)
+
+[filters]
+# Filters allow you to pipe an email body through a shell command to render
+# certain emails differently, e.g. highlighting them with ANSI escape codes.
+#
+# The commands are invoked with sh -c. The following folders are appended to
+# the system $PATH to allow referencing filters from their name only:
+#
+# ${XDG_CONFIG_HOME:-~/.config}/aerc/filters
+# ${XDG_DATA_HOME:-~/.local/share}/aerc/filters
+# $PREFIX/share/aerc/filters
+# /usr/share/aerc/filters
+#
+# The following variables are defined in the filter command environment:
+#
+# AERC_MIME_TYPE the part MIME type/subtype
+# AERC_FILENAME the attachment filename (if any)
+#
+# The first filter which matches the email's mimetype will be used, so order
+# them from most to least specific.
+#
+# You can also match on non-mimetypes, by prefixing with the header to match
+# against (non-case-sensitive) and a comma, e.g. subject,text will match a
+# subject which contains "text". Use header,~regex to match against a regex.
+text/plain=colorize.ansi
+text/calendar=calendar
+message/delivery-status=colorize.ansi
+message/rfc822=colorize.ansi
+#text/html=pandoc -f html -t plain | colorize
+#text/html=html | colorize
+text/html=lynx -display_charset=UTF-8 -force_html -dump -stdin
+#text/*=bat -fP --file-name="$AERC_FILENAME"
+#application/x-sh=bat -fP -l sh
+#image/*=catimg -w $(tput cols) -
+image/*=kitty +kitten icat /dev/stdin
+#subject,~Git(hub|lab)=lolcat -f
+#from,thatguywhodoesnothardwraphismessages=fmt -w 72 | colorize
+
+[openers]
+# Openers allow you to specify the command to use for the :open action on a
+# per-MIME-type basis.
+#
+# {} is expanded as the temporary filename to be opened. If it is not
+# encountered in the command, the temporary filename will be appened to the end
+# of the command.
+#
+# Examples:
+# text/html=surf -dfgms
+# text/plain=gvim {} +125
+# message/rfc822=thunderbird
+application/pdf=zathura
+
+[triggers]
+# Executed when a new email arrives in the selected folder
+new-email=exec dunstify -a aerc -i mail-unread "New mail from %n" "%s"
diff --git a/tw/home/files/aerc/binds.conf b/tw/home/files/aerc/binds.conf
new file mode 100644
index 00000000..28bb5a7f
--- /dev/null
+++ b/tw/home/files/aerc/binds.conf
@@ -0,0 +1,159 @@
+# Binds are of the form <key sequence> = <command to run>
+# To use '=' in a key sequence, substitute it with "Eq": "<Ctrl+Eq>"
+# If you wish to bind #, you can wrap the key sequence in quotes: "#" = quit
+<C-p> = :prev-tab<Enter>
+<C-n> = :next-tab<Enter>
+<C-t> = :term<Enter>
+? = :help keys<Enter>
+
+[messages]
+q = :quit<Enter>
+
+j = :next<Enter>
+<Down> = :next<Enter>
+<C-d> = :next 50%<Enter>
+<C-f> = :next 100%<Enter>
+<PgDn> = :next 100%<Enter>
+
+k = :prev<Enter>
+<Up> = :prev<Enter>
+<C-u> = :prev 50%<Enter>
+<C-b> = :prev 100%<Enter>
+<PgUp> = :prev 100%<Enter>
+g = :select 0<Enter>
+G = :select -1<Enter>
+"#" = :select<space>
+
+J = :next-folder<Enter>
+K = :prev-folder<Enter>
+H = :collapse-folder<Enter>
+L = :expand-folder<Enter>
+
+v = :mark -t<Enter>
+V = :mark -T<Enter>
+F = :flag -x Flagged<Enter>
+<C-r> = :read -t<Enter>
+<semicolon> = :remark<Enter>
+
+T = :toggle-threads<Enter>
+
+<Enter> = :view<Enter>
+D = :delete<Enter>
+A = :archive flat<Enter>
+p = :split 25<Enter>
+
+m = :compose<Enter>
+
+f = :forward -F<Enter>
+a = :reply -aq<Enter>
+r = :reply -q<Enter>
+
+C = :copy<space>
+S = :save<space>
+s = :move<space>
+
+c = :cf<space>
+$ = :check-mail<Enter>
+! = :term<space>
+| = :pipe<space>
+
+/ = :search<space>
+l = :filter<space>
+n = :next-result<Enter>
+N = :prev-result<Enter>
+<Esc> = :clear<Enter>:unmark -a<Enter>
+
+[messages:folder=Drafts]
+<Enter> = :recall<Enter>
+
+[messages:account=Mythic Beasts]
+d = :move Rubbish<Enter>
+# We can't use both :account= and :folder= at the same time, unfortunately.
+[messages:folder=Rubbish]
+d = :delete<Enter>
+
+[messages:account=CERN]
+d = :move Deleted Items<Enter>
+[messages:folder=Deleted Items]
+d = :delete<Enter>
+
+[messages:account=Gmail]
+d = :move [Gmail]/Bin<Enter>
+[messages:folder=[Gmail]/Bin]
+d = :delete<Enter>
+[messages:folder=[Gmail]/Drafts]
+<Enter> = :recall<Enter>
+
+[messages:account=Cantab]
+d = :move Deleted Items<Enter>
+[messages:folder=Deleted Items]
+d = :delete<Enter>
+
+[messages:account=Outlook]
+d = :move Deleted<Enter>
+[messages:folder=Deleted]
+d = :delete<Enter>
+
+[view]
+/ = :toggle-key-passthrough<Enter>/
+q = :close<Enter>
+O = :open<Enter>
+S = :save<space>
+| = :pipe<space>
+D = :delete<Enter>
+A = :archive flat<Enter>
+
+<C-l> = :open-link <space>
+<C-v> = :toggle-key-passthrough<Enter>
+
+f = :forward -F<Enter>
+a = :reply -aq<Enter>
+r = :reply -q<Enter>
+
+H = :toggle-headers<Enter>
+<C-k> = :prev-part<Enter>
+<C-j> = :next-part<Enter>
+J = :next<Enter>
+K = :prev<Enter>
+
+[view::passthrough]
+$noinherit = true
+$ex = <C-x>
+<Esc> = :toggle-key-passthrough<Enter>
+
+[compose]
+# Keybindings used when the embedded terminal is not selected in the compose view.
+$noinherit = true
+$ex = <C-x>
+<C-k> = :prev-field<Enter>
+<C-j> = :next-field<Enter>
+<A-p> = :switch-account -p<Enter>
+<A-n> = :switch-account -n<Enter>
+<tab> = :next-field<Enter>
+<C-p> = :prev-tab<Enter>
+<C-n> = :next-tab<Enter>
+
+[compose::editor]
+# Keybindings used when the embedded terminal is selected in the compose view.
+$noinherit = true
+$ex = <C-x>
+<C-k> = :prev-field<Enter>
+<C-j> = :next-field<Enter>
+<C-p> = :prev-tab<Enter>
+<C-n> = :next-tab<Enter>
+
+[compose::review]
+# Keybindings used when reviewing a message to be sent
+y = :send<Enter>
+n = :abort<Enter>
+p = :postpone<Enter>
+q = :choose -o d discard abort -o p postpone postpone<Enter>
+e = :edit<Enter>
+a = :attach<space>
+d = :detach<space>
+
+[terminal]
+$noinherit = true
+$ex = <C-x>
+<C-p> = :prev-tab<Enter>
+<C-n> = :next-tab<Enter>
diff --git a/tw/home/files/aerc/filters/colorize.ansi b/tw/home/files/aerc/filters/colorize.ansi
new file mode 100755
index 00000000..c21fd804
--- /dev/null
+++ b/tw/home/files/aerc/filters/colorize.ansi
@@ -0,0 +1,134 @@
+#!/usr/bin/env -S awk -f
+# Copyright (c) 2022 Robin Jarry
+# Adapted for standard ANSI colors (for catppuccin theme) by Timo Wilken.
+
+BEGIN {
+ url = "\033[32m" # green
+ header = "\033[35m" # pink
+ signature = "\033[38m" # Surface 2
+ diff_meta = "\033[1;37m" # bold white
+ diff_chunk = "\033[36m" # teal
+ diff_add = "\033[32m" # green
+ diff_del = "\033[31m" # red
+ quote_1 = "\033[38;5;15m" # Subtext 0
+ quote_2 = "\033[37m" # Subtext 1
+ quote_3 = "\033[38m" # Surface 2
+ quote_4 = "\033[30m" # Surface 1
+ quote_x = "\033[30m" # Surface 1
+ bold = "\033[1m"
+ reset = "\033[0m"
+ # state
+ in_diff = 0
+ in_signature = 0
+ in_headers = 0
+ in_body = 0
+ # patterns
+ header_pattern = @/^[A-Z][[:alnum:]-]+:/
+ url_pattern = @/[a-z]{2,6}:\/\/[[:graph:]]+|(mailto:)?[[:alnum:]_\+\.~\/-]*[[:alnum:]_]@[[:lower:]][[:alnum:]\.-]*[[:lower:]]/
+ meta_pattern = @/^(diff --git|(new|deleted) file|similarity index|(rename|copy) (to|from)|index|---|\+\+\+) /
+}
+function color_quote(line) {
+ level = 0
+ quotes = ""
+ while (line ~ /^>/) {
+ level += 1
+ quotes = quotes ">"
+ line = substr(line, 2)
+ while (line ~ /^ /) {
+ quotes = quotes " "
+ line = substr(line, 2)
+ }
+ }
+ if (level == 1) {
+ color = quote_1
+ } else if (level == 2) {
+ color = quote_2
+ } else if (level == 3) {
+ color = quote_3
+ } else if (level == 4) {
+ color = quote_4
+ } else {
+ color = quote_x
+ }
+ if (line ~ meta_pattern) {
+ return color quotes bold line reset
+ } else if (line ~ /^\+/) {
+ return color quotes diff_add line reset
+ } else if (line ~ /^-/) {
+ return color quotes diff_del line reset
+ }
+ gsub(url_pattern, url "&" color, line)
+ return color quotes line reset
+}
+{
+ # Strip carriage returns from line
+ sub(/\r$/, "")
+
+ if (in_diff) {
+ if ($0 ~ /^-- ?$/) {
+ in_diff = 0
+ in_signature = 1
+ $0 = signature $0 reset
+ } else if ($0 ~ /^@@ /) {
+ gsub(/^@@[^@]+@@/, diff_chunk "&" reset)
+ } else if ($0 ~ meta_pattern) {
+ $0 = diff_meta $0 reset
+ } else if ($0 ~ /^\+/) {
+ $0 = diff_add $0 reset
+ } else if ($0 ~ /^-/) {
+ $0 = diff_del $0 reset
+ } else if ($0 !~ /^ / && $0 !~ /^$/) {
+ in_diff = 0
+ in_body = 1
+ if ($0 ~ /^>/) {
+ $0 = color_quote($0)
+ } else {
+ gsub(url_pattern, url "&" reset)
+ }
+ }
+ } else if (in_signature) {
+ gsub(url_pattern, url "&" signature)
+ $0 = signature $0 reset
+ } else if (in_headers) {
+ if ($0 ~ /^$/) {
+ in_headers = 0
+ in_body = 1
+ } else {
+ sub(header_pattern, header "&" reset)
+ gsub(url_pattern, url "&" reset)
+ }
+ } else if (in_body) {
+ if ($0 ~ /^>/) {
+ $0 = color_quote($0)
+ } else if ($0 ~ /^diff --git /) {
+ in_body = 0
+ in_diff = 1
+ $0 = diff_meta $0 reset
+ } else if ($0 ~ /^-- ?$/) {
+ in_body = 0
+ in_signature = 1
+ $0 = signature $0 reset
+ } else {
+ gsub(url_pattern, url "&" reset)
+ }
+ } else if ($0 ~ /^diff --git /) {
+ in_diff = 1
+ $0 = diff_meta $0 reset
+ } else if ($0 ~ /^-- ?$/) {
+ in_signature = 1
+ $0 = signature $0 reset
+ } else if ($0 ~ header_pattern) {
+ in_headers = 1
+ sub(header_pattern, header "&" reset)
+ gsub(url_pattern, url "&" reset)
+ } else {
+ in_body = 1
+ if ($0 ~ /^>/) {
+ $0 = color_quote($0)
+ } else {
+ gsub(url_pattern, url "&" reset)
+ }
+ }
+
+ print
+}
diff --git a/tw/home/files/aerc/stylesets/catppuccin b/tw/home/files/aerc/stylesets/catppuccin
new file mode 100644
index 00000000..ebc7bfba
--- /dev/null
+++ b/tw/home/files/aerc/stylesets/catppuccin
@@ -0,0 +1,36 @@
+*.selected.reverse = false
+*.selected.bg = #585b70
+error.fg = #eba0ac
+warning.fg = #fab387
+success.fg = #a6e3a1
+title.fg = default
+title.bold = true
+header.fg = #f5c2e7
+header.bold = true
+
+msglist_read.default = true
+msglist_unread.fg = #a6e3a1
+msglist_flagged.fg = #eba0ac
+msglist_flagged.bold = true
+msglist_deleted.fg = #f38ba8
+msglist_marked.fg = #f5e0dc
+
+dirlist_default.bg = #11111b
+dirlist_unread.fg = #a6e3a1
+dirlist_recent.fg = #89dceb
+
+tab.bg = #313244
+tab.selected.bold = true
+stack.bg = #6c7086
+spinner.fg = #fab387
+
+statusline_default.bg = #313244
+statusline_error.fg = #eba0ac
+statusline_success.fg = #a6e3a1
+
+completion_default.bg = #11111b
+# The "gutter" contains the scrollbar of the completion popup.
+completion_gutter.bg = #11111b
+# The "pill" is the part of the scrollbar that indicates progress
+# through the list.
+completion_pill.bg = #585b70
diff --git a/tw/home/files/i3.conf b/tw/home/files/i3.conf
index 43e4cead..bac885a2 100644
--- a/tw/home/files/i3.conf
+++ b/tw/home/files/i3.conf
@@ -51,7 +51,7 @@ bindsym $mod+e exec $EDITOR
# remains open in a separate window.
bindsym $mod+slash exec EDITOR=$ASYNC_EDITOR kitty ranger "$(xcwd)"
bindsym $mod+semicolon exec --no-startup-id nheko
-bindsym $mod+shift+colon exec --no-startup-id kitty neomutt
+bindsym $mod+shift+colon exec --no-startup-id kitty aerc
bindsym $mod+y exec kitty pulsemixer
# volume