diff --git a/lib/ui/interfaces.go b/lib/ui/interfaces.go index 7e11725..8a62ecf 100644 --- a/lib/ui/interfaces.go +++ b/lib/ui/interfaces.go @@ -4,6 +4,9 @@ import ( "github.com/gdamore/tcell/v2" ) +// AercMsg is used to communicate within aerc +type AercMsg interface{} + // Drawable is a UI component that can draw. Unless specified, all methods must // only be called from a single goroutine, the UI goroutine. type Drawable interface { diff --git a/lib/ui/ui.go b/lib/ui/ui.go index 632d5f1..d477242 100644 --- a/lib/ui/ui.go +++ b/lib/ui/ui.go @@ -7,6 +7,14 @@ import ( "github.com/gdamore/tcell/v2" ) +var MsgChannel = make(chan AercMsg, 50) + +// QueueRedraw sends a nil message into the MsgChannel. Nothing will handle this +// message, but a redraw will occur if the UI is marked as invalid +func QueueRedraw() { + MsgChannel <- nil +} + type UI struct { Content DrawableInteractive exit atomic.Value // bool