Compare commits

...

2 Commits

Author SHA1 Message Date
Amir Alexander Abdelbaki e9ff562c1e 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>
2026-05-26 13:19:28 +02:00
Amir Alexander Abdelbaki 85e810d70b feat(nvim,alot): full-screen PIM layout + alot Esc bindings
- x now opens a full-screen overlay: alot left (55%), abook top-right,
  calendar bottom-right
- Add esc = exit bindings to alot config for search/thread/taglist/
  bufferlist modes, applied to live ~/.config/alot/config and to the
  mail-notmuch.sh setup script

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 13:12:25 +02:00
4 changed files with 53 additions and 23 deletions

17
alot/config Normal file
View File

@ -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

View File

@ -229,27 +229,26 @@ local function toggle_pim()
return
end
local H = vim.o.lines - 2
local col_w = math.min(vim.o.columns, math.max(90, math.floor(vim.o.columns * 0.45)))
-- full-screen: alot left, abook top-right, calendar bottom-right
local H = vim.o.lines - 2
local W = vim.o.columns
local left_w = math.max(1, math.floor(W * 0.55))
local right_w = math.max(1, W - left_w)
local top_h = math.max(1, math.floor(H / 2))
local bot_h = math.max(1, H - top_h)
-- abook gets a fixed 24-line minimum; mail/calendar split the rest 57/43
local ab_h = math.max(24, math.floor(H * 0.30))
local rest = math.max(2, H - ab_h)
local mail_h = math.max(1, math.floor(rest * 0.57))
local cal_h = math.max(1, rest - mail_h)
local w1 = _pim_float(0, 0, mail_h, col_w)
local w1 = _pim_float(0, 0, H, left_w)
local ok, err = pcall(vim.cmd, "terminal alot")
if not ok then _pim_scratch("alot", err) end
local w2 = _pim_float(mail_h, 0, cal_h, col_w)
ok, err = pcall(vim.cmd, "Calendar -position=here")
if not ok then _pim_scratch("calendar.vim", err) end
local w3 = _pim_float(mail_h + cal_h, 0, ab_h, col_w)
local w2 = _pim_float(0, left_w, top_h, right_w)
ok, err = pcall(vim.cmd, "terminal abook")
if not ok then _pim_scratch("abook", err) end
local w3 = _pim_float(top_h, left_w, bot_h, right_w)
ok, err = pcall(vim.cmd, "Calendar -position=here")
if not ok then _pim_scratch("calendar.vim", err) end
_pim_wins = { w1, w2, w3 }
vim.api.nvim_set_current_win(w1)
end

View File

@ -87,17 +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
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)..."

View File

@ -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