diff options
Diffstat (limited to 'lib/state/texter.go')
-rw-r--r-- | lib/state/texter.go | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/state/texter.go b/lib/state/texter.go index 21cf3627..9212108d 100644 --- a/lib/state/texter.go +++ b/lib/state/texter.go @@ -1,8 +1,12 @@ package state -import "strings" +import ( + "strings" -type Texter interface { + "git.sr.ht/~rjarry/aerc/config" +) + +type texterInterface interface { Connected() string Disconnected() string Passthrough() string @@ -14,6 +18,8 @@ type Texter interface { type text struct{} +var txt text + func (t text) Connected() string { return "Connected" } @@ -44,6 +50,8 @@ func (t text) FormatSearch(s string) string { type icon struct{} +var icn icon + func (i icon) Connected() string { return "✓" } @@ -71,3 +79,12 @@ func (i icon) FormatFilter(s string) string { func (i icon) FormatSearch(s string) string { return strings.ReplaceAll(s, "search", "🔎") } + +func texter() texterInterface { + switch strings.ToLower(config.Statusline.DisplayMode) { + case "icon": + return &icn + default: + return &txt + } +} |