aerc-wizard

aerc and isync auto-configuration
git clone https://git.awy.one/aerc-wizard
Log | Files | Refs | README | LICENSE

commit 11d9aa84d8a4a532a08eb18acba7d84837111d8b
parent 8782e8b6d1b244b19f2ffa7abf42965d1aabe1b0
Author: awy <awy@awy.one>
Date:   Tue,  6 Jan 2026 17:34:50 +0300

change readme and add binds for switching between accounts

reorder binds

Diffstat:
MREADME.md | 47++---------------------------------------------
Maew.1 | 6++----
Mbin/aew | 34++++++++++++++++++++++++++++++++++
Mshare/aerc-binds | 3+++
4 files changed, 41 insertions(+), 49 deletions(-)

diff --git a/README.md b/README.md @@ -11,7 +11,7 @@ Fork of [mutt-wizard](https://github.com/lukesmithxyz/mutt-wizard) with some add Get this great stuff without effort: -- A full-featured and autoconfigured email client on the terminal wibuiltth aerc +- A full-featured and autoconfigured email client on the terminal with aerc - Mail stored offline enabling the ability to: * view and write emails while you're away from the internet @@ -26,7 +26,6 @@ Specifically, this wizard: email address - Encrypts and locally stores your password for easy remote access, accessible only by your GPG key -- Handles as many as nine separate email accounts automatically - Auto-creates bindings to switch between accounts or between mailboxes - Provides sensible defaults and an attractive appearance for the aerc email client @@ -61,7 +60,7 @@ A user of Arch-based distros can also install the current aerc-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 aerc. +- `w3m` - view HTML email in aerc. - `notmuch` - index and search mail. Install it and run `notmuch setup`, tell it that your mail is in `~/.local/share/mail/` (although `aew` will do this automatically if you haven't set notmuch up before). You can run it in mutt @@ -158,55 +157,13 @@ systemctl enable --user goimapnotify@fulladdrs.service to send mail to will suggest contacts that are in your abook. - `urlview` - Outputs URLs in an email to your browser. -## New stuff and improvements since the original release - -- `aew` 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. -- `aew` 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. -- More elegant attachment handling. Image/video/pdf attachments without relying - on the aerc instance. -- abook integration by default. -- The messy template files and other directories have been moved or removed, - leaving a clean config folder. -- msmtp configs moved to `~/.config/` and mail default location moved to - `~/.local/share/mail/`, reducing mess in `~`. -- `gopass` is used as a password manager instead of separately saving passwords. -- 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 aew` -- Now handles POP protocol via `mpop` for those who prefer it (add an account - with the `-p` option). POP configs are still generated automatically. - ## Help the Project! - - Try aerc-wizard out on weird machines and weird email addresses and report any errors. - Open a PR to add new server information into `domains.csv` so their users can more easily use aerc-wizard. -## Details for Tinkerers - -- The critical `aerc` files are in `~/.config/aerc/`. -- Put whatever global settings you want in `accounts.conf`. aerc-wizard will add some - lines to this file, which you shouldn't remove unless you know what you're - doing, but you can move them up/down over your config lines if you need to. If - you get binding conflict errors in mutt, you might need to do this. -- Each of the accounts that aerc-wizard generates will have custom settings set - in a separate file in `accounts/`. You can edit these freely if you want to - tinker with settings specific to an account. -- In `/usr/share/aerc-wizard` are several global config files, including - `aerc-wizard`'s default settings. You can override this in your `muttrc` if - you wish. - ## Watch out for these things - Gmail accounts need to create an diff --git a/aew.1 b/aew.1 @@ -266,10 +266,8 @@ to move mail to the same boxes. .TP .B Switching between accounts aerc-wizard can configure an unlimited number of accounts. Press -.I ctrl-n -to switch to next account or -.I ctrl-p -to switch to previous account. +.I i +followed by an account's number to change to that account: i2, i5, etc. .I ctrl-b to open a menu to select a url you want to open in your browser. .TP diff --git a/bin/aew b/bin/aew @@ -133,6 +133,8 @@ prepaerc() { [ ! -f "$accountsconf" ] && envsubst <"$aercbase" >"$accountsconf" ! grep -q "^multi-file-strategy" "$accountsconf" && envsubst <"$aercbase" >"$accountsconf" envsubst <"$aerctemp" >>"$accountsconf" + sed -i "/# end of account switch binds/i\ + i$idnum = :change-tab $fulladdr<Enter>" "$bindsconf" chmod 600 "$accountsconf" } @@ -373,8 +375,40 @@ reorder() { ' "$accountsconf" >>"$tmp_out" echo >>"$tmp_out" done <"${tempfile}.sorted" + # remove duplicate blank lines awk 'NF{blank=0} !NF{blank++} blank<2' "$tmp_out" >"$accountsconf" rm -f "${tempfile}.clean" "${tempfile}.sorted" + + # reorder account switching binds in binds.conf + getaccounts + start='# account switch binds' + end='# end of account switch binds' + + tmp="$(mktemp)" + trap 'rm -f "$tmp"' EXIT + + { + echo "$start" + i=1 + # iterate over $accounts line by line + while IFS= read -r line; do + # strip the nl number + whitespace + acct="${line##*[[:space:]]}" + [ -z "$acct" ] && continue + printf 'i%d = :change-tab %s<Enter>\n' "$i" "$acct" + i=$((i + 1)) + done <<<"$accounts" + echo "$end" + } >"$tmp" + + # replace the old block in the config + awk -v start="$start" -v end="$end" -v repl="$tmp" ' + $0 == start { system("cat " repl); skip=1; next } + $0 == end { skip=0; next } + !skip + ' "$bindsconf" >"$bindsconf.new" + + mv "$bindsconf.new" "$bindsconf" } while getopts "rfpXlhodTYD:y:i:I:s:S:u:a:n:P:x:m:t:" o; do case "${o}" in diff --git a/share/aerc-binds b/share/aerc-binds @@ -14,6 +14,9 @@ <C-z> = :suspend<Enter> O = :check-mail<Enter> +# account switch binds +# end of account switch binds + [messages] q = :quit<Enter>