feat(alot): track alot config in dotfiles and symlink like other configs
- Add alot/config with account details and esc keybindings - shell-setup.sh: rm -rf ~/.config/alot && ln -sf ~/Dotfiles/alot - mail-notmuch.sh: patch account block in Dotfiles/alot/config via python3 regex instead of overwriting the whole file Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>main
parent
85e810d70b
commit
e9ff562c1e
|
|
@ -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
|
||||
|
|
@ -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)..."
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue