diff options
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/account.go | 4 | ||||
-rw-r--r-- | widgets/aerc.go | 15 | ||||
-rw-r--r-- | widgets/tabhost.go | 1 |
3 files changed, 20 insertions, 0 deletions
diff --git a/widgets/account.go b/widgets/account.go index 86ec00c8..de81ab85 100644 --- a/widgets/account.go +++ b/widgets/account.go @@ -205,6 +205,10 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) { func(msg *models.MessageInfo) { acct.conf.Triggers.ExecNewEmail(acct.acct, acct.conf, msg) + }, func() { + if acct.conf.Ui.NewMessageBell { + acct.host.Beep() + } }) acct.dirlist.SetMsgStore(msg.Info.Name, store) store.OnUpdate(func(_ *lib.MessageStore) { diff --git a/widgets/aerc.go b/widgets/aerc.go index 90b56c82..23dac3e2 100644 --- a/widgets/aerc.go +++ b/widgets/aerc.go @@ -30,6 +30,7 @@ type Aerc struct { statusline *StatusLine pendingKeys []config.KeyStroke tabs *libui.Tabs + beep func() error } func NewAerc(conf *config.AercConfig, logger *log.Logger, @@ -84,6 +85,20 @@ func NewAerc(conf *config.AercConfig, logger *log.Logger, return aerc } +func (aerc *Aerc) OnBeep(f func() error) { + aerc.beep = f +} + +func (aerc *Aerc) Beep() { + if aerc.beep == nil { + aerc.logger.Printf("should beep, but no beeper") + return + } + if err := aerc.beep(); err != nil { + aerc.logger.Printf("tried to beep, but could not: %v", err) + } +} + func (aerc *Aerc) Tick() bool { more := false for _, acct := range aerc.accounts { diff --git a/widgets/tabhost.go b/widgets/tabhost.go index 7c502cb2..2c33cf8d 100644 --- a/widgets/tabhost.go +++ b/widgets/tabhost.go @@ -8,4 +8,5 @@ type TabHost interface { BeginExCommand() SetStatus(status string) *StatusMessage PushStatus(text string, expiry time.Duration) *StatusMessage + Beep() } |