diff options
author | Tim Culverhouse <tim@timculverhouse.com> | 2023-02-03 13:23:08 -0600 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-02-12 00:39:21 +0100 |
commit | 2a0da301c51a8862c4e8a73b141adc0f416833a5 (patch) | |
tree | dabf9adbef3a4732daae91acb11be941ff3c47f9 /config | |
parent | 2df3a079a060bb56aaa4d94df066936cb7b73f9d (diff) | |
download | aerc-2a0da301c51a8862c4e8a73b141adc0f416833a5.tar.gz |
tabs: use template for compose tabs
Use a template for compose tabs.
Other available values:
Account string
Subject string
To []*mail.Address
From []*mail.Address
Cc []*mail.Address
Bcc []*mail.Address
OriginalFrom []*mail.Address
When you use To, From, CC, BCC, or OriginalFrom the title will only be
updated when an editing field has lost focus. This is so we don't end up
calling "PrepareHeader" on every keystroke, which will likely error out
anyways since it will be an invalid header.
Subject still updates every keystroke.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'config')
-rw-r--r-- | config/ui.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/config/ui.go b/config/ui.go index 6c880293..db596d97 100644 --- a/config/ui.go +++ b/config/ui.go @@ -73,7 +73,8 @@ type UIConfig struct { SortThreadSiblings bool `ini:"sort-thread-siblings"` // Tab Templates - TabTitleAccount *template.Template `ini:"-"` + TabTitleAccount *template.Template `ini:"-"` + TabTitleComposer *template.Template `ini:"-"` // private contextualUis []*UiConfigContext @@ -106,6 +107,7 @@ func defaultUiConfig() *UIConfig { flags, _ := templates.ParseTemplate("column-flags", `{{.Flags | join ""}}`) subject, _ := templates.ParseTemplate("column-subject", "{{.Subject}}") tabTitleAccount, _ := templates.ParseTemplate("tab-title-account", "{{.Account}}") + tabTitleComposer, _ := templates.ParseTemplate("tab-title-composer", "{{.Subject}}") return &UIConfig{ IndexFormat: "", // deprecated IndexColumns: []*ColumnDef{ @@ -148,6 +150,7 @@ func defaultUiConfig() *UIConfig { ClientThreadsDelay: 50 * time.Millisecond, NewMessageBell: true, TabTitleAccount: tabTitleAccount, + TabTitleComposer: tabTitleComposer, FuzzyComplete: false, Spinner: "[..] , [..] , [..] , [..] , [..], [..] , [..] , [..] ", SpinnerDelimiter: ",", @@ -362,6 +365,14 @@ index-format will be removed in aerc 0.17. } config.TabTitleAccount = tmpl } + if key, err := section.GetKey("tab-title-composer"); err == nil { + val := key.Value() + tmpl, err := templates.ParseTemplate("tab-title-composer", val) + if err != nil { + return err + } + config.TabTitleComposer = tmpl + } return nil } |