aboutsummaryrefslogtreecommitdiff
path: root/lib/ui
diff options
context:
space:
mode:
authorBen Burwell <ben@benburwell.com>2019-07-29 10:50:02 -0400
committerDrew DeVault <sir@cmpwn.com>2019-07-29 15:01:49 -0400
commit152f8c9519ac1b7b35c3789b03f3d1cc3b1e8881 (patch)
tree0c8693aa2651955d0e12f090f5469c7183e190d3 /lib/ui
parent2804f000017c0ef6bcaf8d571627fa08784f48ac (diff)
Ring bell when new messages arrive0.2.0
Add a "new-message-bell" option to the UI section of aerc.conf. A new hook into the message store allows the msglist widget to detect new messages being added to the displayed list. When new messages are delivered, and the new-message-bell option is enabled (as it is by default), the terminal will beep.
Diffstat (limited to 'lib/ui')
-rw-r--r--lib/ui/interfaces.go9
-rw-r--r--lib/ui/ui.go3
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/ui/interfaces.go b/lib/ui/interfaces.go
index 9008ea7..2f63424 100644
--- a/lib/ui/interfaces.go
+++ b/lib/ui/interfaces.go
@@ -23,6 +23,10 @@ type Interactive interface {
Focus(focus bool)
}
+type Beeper interface {
+ OnBeep(func() error)
+}
+
type Simulator interface {
// Queues up the given input events for simulation
Simulate(events []tcell.Event)
@@ -33,6 +37,11 @@ type DrawableInteractive interface {
Interactive
}
+type DrawableInteractiveBeeper interface {
+ DrawableInteractive
+ Beeper
+}
+
// A drawable which contains other drawables
type Container interface {
Drawable
diff --git a/lib/ui/ui.go b/lib/ui/ui.go
index 13b640b..4c3dd34 100644
--- a/lib/ui/ui.go
+++ b/lib/ui/ui.go
@@ -19,7 +19,7 @@ type UI struct {
}
func Initialize(conf *config.AercConfig,
- content DrawableInteractive) (*UI, error) {
+ content DrawableInteractiveBeeper) (*UI, error) {
screen, err := tcell.NewScreen()
if err != nil {
@@ -57,6 +57,7 @@ func Initialize(conf *config.AercConfig,
content.OnInvalidate(func(_ Drawable) {
atomic.StoreInt32(&state.invalid, 1)
})
+ content.OnBeep(screen.Beep)
content.Focus(true)
return &state, nil