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"
|
chmod +x "$MAILDIR/.notmuch/hooks/post-new"
|
||||||
|
|
||||||
# ── alot ──────────────────────────────────────────────────────────────────────
|
# ── alot ──────────────────────────────────────────────────────────────────────
|
||||||
log "Writing ~/.config/alot/config..."
|
# The bindings section lives in ~/Dotfiles/alot/config (symlinked by shell-setup.sh).
|
||||||
mkdir -p ~/.config/alot
|
# Write only the account block, which contains machine-specific paths/identity.
|
||||||
cat > ~/.config/alot/config << EOF
|
log "Writing account details into ~/Dotfiles/alot/config..."
|
||||||
[accounts]
|
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]]
|
[[main]]
|
||||||
realname = $FULL_NAME
|
realname = {name}
|
||||||
address = $EMAIL
|
address = {email}
|
||||||
sendmail_command = msmtp -a main
|
sendmail_command = msmtp -a main
|
||||||
sent_box = maildir://$MAILDIR/Sent
|
sent_box = maildir://{maildir}/Sent
|
||||||
draft_box = maildir://$MAILDIR/Drafts
|
draft_box = maildir://{maildir}/Drafts
|
||||||
|
"""
|
||||||
[bindings]
|
with open(path) as f:
|
||||||
[[search]]
|
text = f.read()
|
||||||
esc = exit
|
text = re.sub(r'\[accounts\].*?(?=\n\[|\Z)', block, text, flags=re.DOTALL)
|
||||||
[[thread]]
|
with open(path, 'w') as f:
|
||||||
esc = exit
|
f.write(text)
|
||||||
[[taglist]]
|
PYEOF
|
||||||
esc = exit
|
|
||||||
[[bufferlist]]
|
|
||||||
esc = exit
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# ── systemd timer for periodic sync ───────────────────────────────────────────
|
# ── systemd timer for periodic sync ───────────────────────────────────────────
|
||||||
log "Installing mbsync systemd user timer (every 5 min)..."
|
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)..."
|
log "Syncing neovim plugins (lazy.nvim)..."
|
||||||
nvim --headless "+Lazy! sync" +qa 2>/dev/null || true
|
nvim --headless "+Lazy! sync" +qa 2>/dev/null || true
|
||||||
|
|
||||||
|
rm -rf ~/.config/alot
|
||||||
|
ln -sf ~/Dotfiles/alot ~/.config/alot
|
||||||
|
|
||||||
rm -rf ~/.config/yazi
|
rm -rf ~/.config/yazi
|
||||||
ln -sf ~/Dotfiles/yazi ~/.config/yazi
|
ln -sf ~/Dotfiles/yazi ~/.config/yazi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue