MBIDLED(1)

πŸ“¦ version 0-unstable-2023-09, in nixos 26.05, nixpkgs unstable

πŸ’Œ MBIDLED(1) β€” the group-chat manual page πŸ’Œ

okay so bestie, this is mbidled, from the General Commands Manual section β€” yes that manual. Sit down, grab a strawberry πŸ“, and let me tell you about the little daemon-ish icon that runs a command whenever your mailbox changes. It's giving "personal assistant who lives in your terminal" energy, honestly.


✨ NAME ✨

mbidled β€” run a command when your mailbox changes. That's it. That's the whole vibe. πŸ¦‹


🌸 SYNOPSIS 🌸

mbidled -c MBSYNC_CONFIG [-e COMMAND] [OPTION]...

πŸ’– DESCRIPTION πŸ’–

mbidled runs COMMAND whenever your mailbox changes. Iconic behaviour, no notes. πŸ‘‘

⚠️ CAUTION, bestie, fr fr: this program has not been tested outside the author's own setup. Use it with care. Like, it's cute but it's also a little unhinged β€” please be careful. 😭

πŸŽ€ COMMANDS πŸŽ€

  • -c MBSYNC_CONFIG β€” path to the mbsync(1) configuration file you want it to use. This one's basically required, it's the main character πŸ”₯
  • -e COMMAND β€” run the shell COMMAND when the mailbox changes. By default, it just syncs the changed mailbox:
mbsync -c $MBIDLED_CONFIG $MBIDLED_CHANNEL:$MBIDLED_MAILBOX

And the following environment variables get set for the program it executes πŸ’…:

  • $MBIDLED_CONFIG β€” the argument you passed to -c.
  • $MBIDLED_CHANNEL β€” the name of the changed Channel.
  • $MBIDLED_MAILBOX β€” the name of the changed mailbox.
  • -v β€” be verbose. πŸ—£οΈ Heads up though: the output may contain sensitive information, so maybe don't paste it in the group chat, iykyk πŸ™ˆ
  • -h β€” display help and exit. The "just tell me what to do" button 🫢

πŸ¦‹ STORES πŸ¦‹

mbidled can watch for mailbox changes in the following stores. Two flavours, both slay ✨

πŸ’œ IMAP

IMAP config gets read from IMAPAccount sections.

It uses the IMAP4 IDLE command (RFC 2177) to watch for changes in INBOX and all mailboxes in the INBOX. namespace. Yes, all of them. Obsessed. 🌈

🧚 Maildir

Mailboxes that have a prefix of MaildirStore.Path and MaildirStore.Inbox are the ones being watched.

The filesystem is watched using inotify(7) on Linux systems (if it's supported), or using periodic stat(2) calls in all other cases β€” refer to libev for the exact details, because that's where the actual magic lives ⭐


πŸ‘‘ CONFIGURATION πŸ‘‘

mbidled was designed to use the configuration file (and format) of mbsync. Reusing the fit, we love to see it πŸ’…

Besides the standard configuration options, mbidled recognizes some extra options. All of these extension options start with a comment marker character (#) so that they're completely ignored by mbsync. Sneaky? No. Clever. πŸŽ€

The prefix (the part before the colon) is case-sensitive. Don't get cute with the capitalisation, bestie.

🌟 Global

  • #MBIDLED:StrictPropagate [None|Far|Near|Both] β€” okay so here's the situation: changes from stores can get registered while COMMAND is still running, but there's no way to know whether the program actually handled that change properly, or maybe it completely missed it. 😭 For that reason, the command is scheduled for a re-run to make sure it knows about the latest updates. But β€” and this is the lowkey funny part β€” in the vast majority of cases that second run would likely be a no-op, because the change is often generated by the started program itself. This option specifies which sides of the channel should schedule a new command run upon a change (thus propagating potential changes). Optimal choice between safety and low server load can be: for PullNew or PushNew, specify Far or Near for this option respectively β€” that means the side where new mails come from is surely re-checked. (Default=Both) πŸ‘―
  • #MBIDLED:StartTimeout time β€” after registering a change, wait this many seconds before starting COMMAND. Stores may emit multiple change notifications for the same change event, so waiting a bit can be useful. (Default=1) ⏳
  • #MBIDLED:StartInterval time β€” do not run COMMAND more often than this many seconds. Boundaries, bestie, we're setting them. (Default=30) πŸ›‘
  • #MBIDLED:Option ... β€” process the line as if there were no prefix given at all. Can be useful to tweak some options exclusively for mbidled. Main character energy for your config file πŸ”₯

Examples:

# Disable watching channel.
#MBIDLED:Sync None

# Watch specific mailboxes only.
#MBIDLED:Patterns Archive Sent

πŸ” SEE ALSO πŸ”

  • mbsync(1) β€” go read it, it's the whole reason this exists 🫢

and that's the page, bestie!! πŸ’– this little gem is dated May 2022 and it lives in the MBIDLED(1) slot of the General Commands Manual β€” go forth and let your mailbox changes trigger commands like the icon you are πŸŒˆβœ¨πŸŽ€

πŸ“¦ where this page comes from