diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/aerc.conf | 62 | ||||
-rw-r--r-- | config/statusline.go | 2 | ||||
-rw-r--r-- | config/style.go | 126 | ||||
-rw-r--r-- | config/ui.go | 29 |
4 files changed, 91 insertions, 128 deletions
diff --git a/config/aerc.conf b/config/aerc.conf index 22c6d359..51c73a8f 100644 --- a/config/aerc.conf +++ b/config/aerc.conf @@ -76,8 +76,8 @@ # terminal width. Fit width columns take the width of their contents. If no # width specifier is set, '*' is used by default. # -# Default: date<20,name<17,flags>4,subject<* -#index-columns=date<20,name<17,flags>4,subject<* +# Default: flags:4,name<20%,subject,date>= +#index-columns=flags:4,name<20%,subject,date>= # # Each name in index-columns must have a corresponding column-$name setting. @@ -93,10 +93,10 @@ # column-name={{if match .Folder "^(Gesendet|Sent)$"}}{{index (.To | names) 0}}{{else}}{{index (.From | names) 0}}{{end}} # # Default settings -#column-date={{.DateAutoFormat .Date.Local}} -#column-name={{index (.From | names) 0}} #column-flags={{.Flags | join ""}} -#column-subject={{.ThreadPrefix}}{{if .ThreadFolded}}{{printf "{%d}" .ThreadCount}}{{end}}{{.Subject}} +#column-name={{index (.From | names) 0}} +#column-subject={{.ThreadPrefix}}{{.Subject}} +#column-date={{.DateAutoFormat .Date.Local}} # # String separator inserted between columns. When the column width specifier is @@ -109,31 +109,35 @@ # # See time.Time#Format at https://godoc.org/time#Time.Format # -# Default: 2006-01-02 03:04 PM (ISO 8601 + 12 hour time) -#timestamp-format=2006-01-02 03:04 PM +# Default: 2006 Jan 02 +#timestamp-format=2006 Jan 02 # # Index-only time format for messages that were received/sent today. -# If this is not specified, timestamp-format is used instead. +# If this is empty, timestamp-format is used instead. # -#this-day-time-format= +# Default: 15:04 +#this-day-time-format=15:04 # # Index-only time format for messages that were received/sent within the last -# 7 days. If this is not specified, timestamp-format is used instead. +# 7 days. If this is empty, timestamp-format is used instead. # -#this-week-time-format= +# Default: Jan 02 +#this-week-time-format=Jan 02 # # Index-only time format for messages that were received/sent this year. -# If this is not specified, timestamp-format is used instead. +# If this is empty, timestamp-format is used instead. # -#this-year-time-format= +#Default: Jan 02 +#this-year-time-format=Jan 02 # -# If set, overrides timestamp-format for the message view. +# Overrides timestamp-format for the message view. # -#message-view-timestamp-format= +# Default: 2006 Jan 02, 15:04 GMT-0700 +#message-view-timestamp-format=2006 Jan 02, 15:04 GMT-0700 # # If set, overrides timestamp-format in the message view for messages @@ -155,8 +159,8 @@ # # Width of the sidebar, including the border. # -# Default: 20 -#sidebar-width=20 +# Default: 22 +#sidebar-width=22 # # Message to display when viewing an empty folder. @@ -194,14 +198,14 @@ # # Template to use for Composer tab titles # -# Default: {{.Subject}} -#tab-title-composer={{.Subject}} +# Default: {{if .To}}to:{{index (.To | shortmboxes) 0}} {{end}}{{.SubjectBase}} +#tab-title-composer={{if .To}}to:{{index (.To | shortmboxes) 0}} {{end}}{{.SubjectBase}} # # Template to use for Message Viewer tab titles # -# Default: {{if .Subject}}{{.Subject}}{{else}}(no subject){{end}} -#tab-title-viewer={{if .Subject}}{{.Subject}}{{else}}(no subject){{end}} +# Default: {{.Subject}} +#tab-title-viewer={{.Subject}} # Marker to show before a pinned tab's name. @@ -218,8 +222,8 @@ # Template for the right side of the directory list. # See aerc-templates(7) for all available fields and functions. # -# Default: {{if .Unread}}{{humanReadable .Unread}}/{{end}}{{if .Exists}}{{humanReadable .Exists}}{{end}} -#dirlist-right={{if .Unread}}{{humanReadable .Unread}}/{{end}}{{if .Exists}}{{humanReadable .Exists}}{{end}} +# Default: {{if .Unread}}{{humanReadable .Unread}}{{end}} +#dirlist-right={{if .Unread}}{{humanReadable .Unread}}{{end}} # Delay after which the messages are actually listed when entering a directory. # This avoids loading messages when skipping over folders and makes the UI more @@ -272,9 +276,9 @@ # Uncomment to use box-drawing characters for vertical and horizontal borders. # -# Default: " " -#border-char-vertical=" " -#border-char-horizontal=" " +# Default: "│" and "─" +#border-char-vertical="│" +#border-char-horizontal="─" # Sets the styleset to use for the aerc ui elements. # @@ -409,8 +413,8 @@ # Customize the thread prefix appearance by selecting the folded thread # indicator. # -# Default: "" -#thread-prefix-folded = "" +# Default: "+" +#thread-prefix-folded = "+" # # Customize the thread prefix appearance by selecting the unfolded thread @@ -492,7 +496,7 @@ # Default settings #column-left=[{{.Account}}] {{.StatusInfo}} #column-center={{.PendingKeys}} -#column-right={{.TrayInfo}} +#column-right={{.TrayInfo}} | {{cwd}} # # String separator inserted between columns. diff --git a/config/statusline.go b/config/statusline.go index f00067db..964f3f54 100644 --- a/config/statusline.go +++ b/config/statusline.go @@ -32,7 +32,7 @@ func (s *StatuslineConfig) ParseColumns(sec *ini.Section, key *ini.Key) ([]*Colu _, _ = sec.NewKey("column-center", "{{.PendingKeys}}") } if !sec.HasKey("column-right") { - _, _ = sec.NewKey("column-right", "{{.TrayInfo}}") + _, _ = sec.NewKey("column-right", "{{.TrayInfo}} | {{cwd}}") } return ParseColumnDefs(key, sec) } diff --git a/config/style.go b/config/style.go index efe84722..1b428f45 100644 --- a/config/style.go +++ b/config/style.go @@ -304,6 +304,40 @@ type StyleSet struct { path string } +const defaultStyleset string = ` +*.selected.bg = 12 +*.selected.fg = 15 +*.selected.bold = true +statusline_*.dim = true +statusline_*.bg = 8 +statusline_*.fg = 15 +*warning.fg = 3 +*success.fg = 2 +*error.fg = 1 +*error.bold = true +border.fg = 12 +border.bold = true +title.bg = 12 +title.fg = 15 +title.bold = true +header.fg = 4 +header.bold = true +msglist_unread.bold = true +msglist_deleted.dim = true +msglist_marked.bg = 6 +msglist_marked.fg = 15 +msglist_pill.bg = 12 +msglist_pill.fg = 15 +part_mimetype.fg = 12 +selector_chooser.bold = true +selector_focused.bold = true +selector_focused.bg = 12 +selector_focused.fg = 15 +completion_pill.bg = 12 +completion_default.bg = 8 +completion_default.fg = 15 +` + func NewStyleSet() StyleSet { ss := StyleSet{ objects: make(map[StyleObject]*StyleConf), @@ -311,89 +345,15 @@ func NewStyleSet() StyleSet { user: make(map[string]*Style), } for _, so := range StyleNames { - conf := new(StyleConf) - - switch so { - case STYLE_ERROR: - // *error.bold=true - conf.base.Bold = true - // error.fg=red - conf.base.Fg = vaxis.IndexColor(1) - case STYLE_WARNING: - // warning.fg=yellow - conf.base.Fg = vaxis.IndexColor(3) - case STYLE_SUCCESS: - // success.fg=green - conf.base.Fg = vaxis.IndexColor(2) - case STYLE_TITLE: - // title.reverse=true - conf.base.Reverse = true - case STYLE_HEADER: - // header.bold=true - conf.base.Bold = true - case STYLE_STATUSLINE_DEFAULT: - // statusline_default.reverse=true - conf.base.Reverse = true - case STYLE_STATUSLINE_ERROR: - // *error.bold=true - conf.base.Fg = vaxis.IndexColor(1) - // statusline_error.fg=red - conf.base.Bold = true - // statusline_error.reverse=true - conf.base.Reverse = true - case STYLE_STATUSLINE_WARNING: - // statusline_warning.fg=yellow - conf.base.Fg = vaxis.IndexColor(3) - // statusline_warning.reverse=true - conf.base.Reverse = true - case STYLE_STATUSLINE_SUCCESS: - conf.base.Fg = vaxis.IndexColor(2) - conf.base.Reverse = true - case STYLE_MSGLIST_UNREAD: - // msglist_unread.bold=true - conf.base.Bold = true - case STYLE_MSGLIST_DELETED: - // msglist_deleted.fg=gray - conf.base.Fg = vaxis.IndexColor(8) - case STYLE_MSGLIST_RESULT: - // msglist_result.fg=green - conf.base.Fg = vaxis.IndexColor(2) - case STYLE_MSGLIST_PILL: - // msglist_pill.reverse=true - conf.base.Reverse = true - case STYLE_PART_MIMETYPE: - // part_mimetype.dim=true - conf.base.Dim = true - case STYLE_COMPLETION_PILL: - // completion_pill.reverse=true - conf.base.Reverse = true - case STYLE_TAB: - // tab.reverse=true - conf.base.Reverse = true - case STYLE_BORDER: - // border.reverse = true - conf.base.Reverse = true - case STYLE_SELECTOR_FOCUSED: - // selector_focused.reverse=true - conf.base.Reverse = true - case STYLE_SELECTOR_CHOOSER: - // selector_chooser.bold=true - conf.base.Bold = true - } - - ss.objects[so] = conf - selected := *conf - // *.selected.reverse=toggle - selected.base.Reverse = !conf.base.Reverse - switch so { - case STYLE_PART_MIMETYPE: - // part_mimetype.selected.dim=false - selected.base.Dim = false - case STYLE_PART_FILENAME: - // part_filename.selected.bold=true - selected.base.Bold = true - } - ss.selected[so] = &selected + ss.objects[so] = new(StyleConf) + ss.selected[so] = new(StyleConf) + } + f, err := ini.Load([]byte(defaultStyleset)) + if err == nil { + err = ss.ParseStyleSet(f) + } + if err != nil { + panic(err) } return ss } diff --git a/config/ui.go b/config/ui.go index ba7ba967..e7e96f9f 100644 --- a/config/ui.go +++ b/config/ui.go @@ -15,23 +15,23 @@ import ( ) type UIConfig struct { - IndexColumns []*ColumnDef `ini:"index-columns" parse:"ParseIndexColumns" default:"date<20,name<17,flags>4,subject<*"` + IndexColumns []*ColumnDef `ini:"index-columns" parse:"ParseIndexColumns" default:"flags:4,name<20%,subject,date>="` ColumnSeparator string `ini:"column-separator" default:" "` DirListLeft *template.Template `ini:"dirlist-left" default:"{{.Folder}}"` - DirListRight *template.Template `ini:"dirlist-right" default:"{{if .Unread}}{{humanReadable .Unread}}/{{end}}{{if .Exists}}{{humanReadable .Exists}}{{end}}"` + DirListRight *template.Template `ini:"dirlist-right" default:"{{if .Unread}}{{humanReadable .Unread}}{{end}}"` AutoMarkRead bool `ini:"auto-mark-read" default:"true"` - TimestampFormat string `ini:"timestamp-format" default:"2006-01-02 03:04 PM"` - ThisDayTimeFormat string `ini:"this-day-time-format"` - ThisWeekTimeFormat string `ini:"this-week-time-format"` - ThisYearTimeFormat string `ini:"this-year-time-format"` - MessageViewTimestampFormat string `ini:"message-view-timestamp-format"` + TimestampFormat string `ini:"timestamp-format" default:"2006 Jan 02"` + ThisDayTimeFormat string `ini:"this-day-time-format" default:"15:04"` + ThisWeekTimeFormat string `ini:"this-week-time-format" default:"Jan 02"` + ThisYearTimeFormat string `ini:"this-year-time-format" default:"Jan 02"` + MessageViewTimestampFormat string `ini:"message-view-timestamp-format" default:"2006 Jan 02, 15:04 GMT-0700"` MessageViewThisDayTimeFormat string `ini:"message-view-this-day-time-format"` MessageViewThisWeekTimeFormat string `ini:"message-view-this-week-time-format"` MessageViewThisYearTimeFormat string `ini:"message-view-this-year-time-format"` PinnedTabMarker string "ini:\"pinned-tab-marker\" default:\"`\"" - SidebarWidth int `ini:"sidebar-width" default:"20"` + SidebarWidth int `ini:"sidebar-width" default:"22"` EmptyMessage string `ini:"empty-message" default:"(no messages)"` EmptyDirlist string `ini:"empty-dirlist" default:"(no folders)"` EmptySubject string `ini:"empty-subject" default:"(no subject)"` @@ -72,8 +72,8 @@ type UIConfig struct { StyleSetName string `ini:"styleset-name" default:"default"` style StyleSet // customize border appearance - BorderCharVertical rune `ini:"border-char-vertical" default:" " type:"rune"` - BorderCharHorizontal rune `ini:"border-char-horizontal" default:" " type:"rune"` + BorderCharVertical rune `ini:"border-char-vertical" default:"│" type:"rune"` + BorderCharHorizontal rune `ini:"border-char-horizontal" default:"─" type:"rune"` ReverseOrder bool `ini:"reverse-msglist-order"` ReverseThreadOrder bool `ini:"reverse-thread-order"` @@ -83,7 +83,7 @@ type UIConfig struct { ThreadPrefixIndent string `ini:"thread-prefix-indent" default:" "` ThreadPrefixStem string `ini:"thread-prefix-stem" default:"│"` ThreadPrefixLimb string `ini:"thread-prefix-limb" default:""` - ThreadPrefixFolded string `ini:"thread-prefix-folded" default:""` + ThreadPrefixFolded string `ini:"thread-prefix-folded" default:"+"` ThreadPrefixUnfolded string `ini:"thread-prefix-unfolded" default:""` ThreadPrefixFirstChild string `ini:"thread-prefix-first-child" default:""` ThreadPrefixHasSiblings string `ini:"thread-prefix-has-siblings" default:"├─"` @@ -96,8 +96,8 @@ type UIConfig struct { // Tab Templates TabTitleAccount *template.Template `ini:"tab-title-account" default:"{{.Account}}"` - TabTitleComposer *template.Template `ini:"tab-title-composer" default:"{{.Subject}}"` - TabTitleViewer *template.Template `ini:"tab-title-viewer" default:"{{if .Subject}}{{.Subject}}{{else}}(no subject){{end}}"` + TabTitleComposer *template.Template `ini:"tab-title-composer" default:"{{if .To}}to:{{index (.To | shortmboxes) 0}} {{end}}{{.SubjectBase}}"` + TabTitleViewer *template.Template `ini:"tab-title-viewer" default:"{{.Subject}}"` // private contextualUis []*UiConfigContext @@ -228,8 +228,7 @@ func (*UIConfig) ParseIndexColumns(section *ini.Section, key *ini.Key) ([]*Colum _, _ = section.NewKey("column-flags", `{{.Flags | join ""}}`) } if !section.HasKey("column-subject") { - _, _ = section.NewKey("column-subject", - `{{.ThreadPrefix}}{{if .ThreadFolded}}{{printf "{%d}" .ThreadCount}}{{end}}{{.Subject}}`) + _, _ = section.NewKey("column-subject", `{{.ThreadPrefix}}{{.Subject}}`) } return ParseColumnDefs(key, section) } |