diff --git a/alot/config b/alot/config new file mode 100644 index 0000000..f0f061e --- /dev/null +++ b/alot/config @@ -0,0 +1,17 @@ +[accounts] + [[main]] + realname = amir alexander abdelbaki + address = amir@abdelbaki.eu + sendmail_command = msmtp -a main + sent_box = maildir:///home/themiro/Mail/Sent + draft_box = maildir:///home/themiro/Mail/Drafts + +[bindings] + [[search]] + esc = exit + [[thread]] + esc = exit + [[taglist]] + esc = exit + [[bufferlist]] + esc = exit diff --git a/setup/modules/optional-Modules/apps/mail-notmuch.sh b/setup/modules/optional-Modules/apps/mail-notmuch.sh index 2668631..2827c58 100755 --- a/setup/modules/optional-Modules/apps/mail-notmuch.sh +++ b/setup/modules/optional-Modules/apps/mail-notmuch.sh @@ -87,27 +87,28 @@ EOF chmod +x "$MAILDIR/.notmuch/hooks/post-new" # ── alot ────────────────────────────────────────────────────────────────────── -log "Writing ~/.config/alot/config..." -mkdir -p ~/.config/alot -cat > ~/.config/alot/config << EOF -[accounts] +# The bindings section lives in ~/Dotfiles/alot/config (symlinked by shell-setup.sh). +# Write only the account block, which contains machine-specific paths/identity. +log "Writing account details into ~/Dotfiles/alot/config..." +ALOT_CFG="$HOME/Dotfiles/alot/config" +# Replace the [[main]] account block in-place (sed removes old block, cat appends new one) +python3 - "$ALOT_CFG" "$FULL_NAME" "$EMAIL" "$MAILDIR" << 'PYEOF' +import sys, re +path, name, email, maildir = sys.argv[1:] +block = f"""[accounts] [[main]] - realname = $FULL_NAME - address = $EMAIL + realname = {name} + address = {email} sendmail_command = msmtp -a main - sent_box = maildir://$MAILDIR/Sent - draft_box = maildir://$MAILDIR/Drafts - -[bindings] - [[search]] - esc = exit - [[thread]] - esc = exit - [[taglist]] - esc = exit - [[bufferlist]] - esc = exit -EOF + sent_box = maildir://{maildir}/Sent + draft_box = maildir://{maildir}/Drafts +""" +with open(path) as f: + text = f.read() +text = re.sub(r'\[accounts\].*?(?=\n\[|\Z)', block, text, flags=re.DOTALL) +with open(path, 'w') as f: + f.write(text) +PYEOF # ── systemd timer for periodic sync ─────────────────────────────────────────── log "Installing mbsync systemd user timer (every 5 min)..." diff --git a/setup/modules/shell-setup.sh b/setup/modules/shell-setup.sh index 7de96b5..8534820 100755 --- a/setup/modules/shell-setup.sh +++ b/setup/modules/shell-setup.sh @@ -75,6 +75,9 @@ ln -sf ~/Dotfiles/nvim ~/.config/nvim log "Syncing neovim plugins (lazy.nvim)..." nvim --headless "+Lazy! sync" +qa 2>/dev/null || true +rm -rf ~/.config/alot +ln -sf ~/Dotfiles/alot ~/.config/alot + rm -rf ~/.config/yazi ln -sf ~/Dotfiles/yazi ~/.config/yazi