summary refs log tree commit diff stats
path: root/widgets/aerc.go
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/aerc.go')
-rw-r--r--widgets/aerc.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/widgets/aerc.go b/widgets/aerc.go
index 90b56c8..23dac3e 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 {