Documentation
¶
Overview ¶
Package mail is the unread-mail service, the Go counterpart of crates/wayle-shell-core's services/mail: notmuch queries (one per account, or the single query), re-run when the notmuch maildir changes, with optional desktop notifications for newly-arrived messages. The bar module and the dropdown both read one Service.
Index ¶
Constants ¶
const Debounce = 500 * time.Millisecond
Debounce coalesces a maildir-sync burst into one re-query.
const NotifyMax = 5
NotifyMax caps how many per-message notifications one arrival burst fires, so a large sync cannot flood the notification daemon.
Variables ¶
This section is empty.
Functions ¶
func InstallProviderIcons ¶
InstallProviderIcons is install_provider_icons: a best-effort install of the configured providers' brand icons. Failures (offline, an unknown slug) are logged and leave the account on the generic icon.
Types ¶
type AccountUnread ¶
AccountUnread is one account's resolved icon and unread count.
type CLI ¶
type CLI struct{}
CLI runs the notmuch binary, as the Rust service does.
func (CLI) DatabasePath ¶
DatabasePath is `notmuch config get database.path` (maildir_path).
type DesktopNotifier ¶
type DesktopNotifier struct {
Sender *desktopnotify.Sender
}
DesktopNotifier fires mail notifications as "lys-shell" through the session notification daemon.
func (DesktopNotifier) Notify ¶
func (d DesktopNotifier) Notify(summary, body, icon string)
Notify sends in the background; failures are logged, never returned, as a missing notification must not fail the re-query.
type Notifier ¶
type Notifier interface {
Notify(summary, body, icon string)
}
Notifier fires one desktop notification, fire-and-forget.
type Notmuch ¶
type Notmuch interface {
// Count is `notmuch count <query>`, 0 on any failure.
Count(ctx context.Context, query string) uint32
// Newest returns up to limit newest matches, empty on failure.
Newest(ctx context.Context, query string, limit int) []Message
// DatabasePath is `notmuch config get database.path`; ok=false
// when there is no database to watch.
DatabasePath(ctx context.Context) (string, bool)
}
Notmuch is the query seam.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service holds the counts and runs the watch loop.
func New ¶
func New(cfg config.MailConfig, notmuch Notmuch, notifier Notifier) *Service
New builds a service; Run starts it. A nil notifier disables notifications regardless of the notify key.
func (*Service) Run ¶
Run seeds the counts without notifying (existing unread mail at startup is not "new"), then re-queries after each settled burst of maildir changes until ctx ends. Without a notmuch database the seed is all there is, as in the Rust service. The watch is armed before the seed query so a change during it is not lost.
type State ¶
type State struct {
Accounts []AccountUnread
Total uint32
}
State is one published read: the per-account counts in config order (empty without accounts) and the total.