aboutsummaryrefslogtreecommitdiffstats
path: root/aerc.go
diff options
context:
space:
mode:
Diffstat (limited to 'aerc.go')
-rw-r--r--aerc.go20
1 files changed, 12 insertions, 8 deletions
diff --git a/aerc.go b/aerc.go
index e1a1345b..e5801a0c 100644
--- a/aerc.go
+++ b/aerc.go
@@ -9,9 +9,9 @@ import (
"runtime"
"sort"
"strings"
- "time"
"git.sr.ht/~sircmpwn/getopt"
+ "github.com/gdamore/tcell/v2"
"github.com/mattn/go-isatty"
"github.com/xo/terminfo"
@@ -28,6 +28,7 @@ import (
libui "git.sr.ht/~rjarry/aerc/lib/ui"
"git.sr.ht/~rjarry/aerc/logging"
"git.sr.ht/~rjarry/aerc/widgets"
+ "git.sr.ht/~rjarry/aerc/worker/types"
)
func getCommands(selected libui.Drawable) []*commands.Commands {
@@ -241,15 +242,18 @@ func main() {
setWindowTitle()
}
- go ui.ProcessEvents()
- for !ui.ShouldExit() {
- for aerc.Tick() {
- // Continue updating our internal state
+ ui.ChannelEvents()
+ for event := range libui.MsgChannel {
+ switch event := event.(type) {
+ case tcell.Event:
+ ui.HandleEvent(event)
+ case types.WorkerMessage:
+ aerc.HandleMessage(event)
}
- if !ui.Render() {
- // ~60 FPS
- time.Sleep(16 * time.Millisecond)
+ if ui.ShouldExit() {
+ break
}
+ ui.Render()
}
err = aerc.CloseBackends()
if err != nil {