From ce18e928813526e59462e391c09e868c62facb42 Mon Sep 17 00:00:00 2001 From: Koni Marti Date: Mon, 18 Apr 2022 16:06:27 +0200 Subject: statusline: refactor to make it more customizable Refactor statusline by clearly separating the rendering part from the text display. Use printf-like format string for statusline customization. Document printf-like format string to customize the statusline. Allow to completely mute the statusline (except for push notifications) with a format specifier. Provide a display mode with unicode icons for the status elements. Implements: https://todo.sr.ht/~rjarry/aerc/34 Signed-off-by: Koni Marti Acked-by: Robin Jarry --- widgets/account.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'widgets') diff --git a/widgets/account.go b/widgets/account.go index 994bba6..b34396b 100644 --- a/widgets/account.go +++ b/widgets/account.go @@ -59,7 +59,7 @@ func NewAccountView(aerc *Aerc, conf *config.AercConfig, acct *config.AccountCon conf: conf, host: host, logger: logger, - state: statusline.NewState(acct.Name, len(conf.Accounts) > 1, " | "), + state: statusline.NewState(acct.Name, len(conf.Accounts) > 1, conf.Statusline), } view.grid = ui.NewGrid().Rows([]ui.GridSpec{ @@ -170,6 +170,9 @@ func (acct *AccountView) Invalidate() { } func (acct *AccountView) Draw(ctx *ui.Context) { + if acct.state.SetWidth(ctx.Width()) { + acct.UpdateStatus() + } acct.grid.Draw(ctx) } -- cgit v1.2.3