mirror of
https://git.sr.ht/~rjarry/aerc
synced 2025-02-22 14:53:57 +01:00

The default styleset and ui settings are quite dull and don't make use of the "newer" features that have been added to aerc in the past two years. Change the default styleset to something more colorful that renders correctly on both dark and light backgrounds. Change the default ui settings to get something more appealing to new users. Save the previous default color theme to a new `monochrome` styleset. Changelog-changed: The default `[ui]` settings and the `default` styleset have changed extensively. A no-color theme can be restored with the `monochrome` styleset. Cc: Marc Coquand <marc@mccd.space> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
38 lines
1.1 KiB
Go
38 lines
1.1 KiB
Go
package config
|
|
|
|
import (
|
|
"git.sr.ht/~rjarry/aerc/lib/log"
|
|
"github.com/go-ini/ini"
|
|
)
|
|
|
|
type StatuslineConfig struct {
|
|
StatusColumns []*ColumnDef `ini:"status-columns" parse:"ParseColumns" default:"left<*,center>=,right>*"`
|
|
ColumnSeparator string `ini:"column-separator" default:" "`
|
|
Separator string `ini:"separator" default:" | "`
|
|
DisplayMode string `ini:"display-mode" default:"text"`
|
|
}
|
|
|
|
var Statusline = new(StatuslineConfig)
|
|
|
|
func parseStatusline(file *ini.File) error {
|
|
statusline := file.Section("statusline")
|
|
if err := MapToStruct(statusline, Statusline, true); err != nil {
|
|
return err
|
|
}
|
|
|
|
log.Debugf("aerc.conf: [statusline] %#v", Statusline)
|
|
return nil
|
|
}
|
|
|
|
func (s *StatuslineConfig) ParseColumns(sec *ini.Section, key *ini.Key) ([]*ColumnDef, error) {
|
|
if !sec.HasKey("column-left") {
|
|
_, _ = sec.NewKey("column-left", "[{{.Account}}] {{.StatusInfo}}")
|
|
}
|
|
if !sec.HasKey("column-center") {
|
|
_, _ = sec.NewKey("column-center", "{{.PendingKeys}}")
|
|
}
|
|
if !sec.HasKey("column-right") {
|
|
_, _ = sec.NewKey("column-right", "{{.TrayInfo}} | {{cwd}}")
|
|
}
|
|
return ParseColumnDefs(key, sec)
|
|
}
|