aboutsummaryrefslogblamecommitdiffstats
path: root/config/statusline.go
blob: 483241c0add93d7172454473a65a656da3569f6c (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13


              
                                    








                                                 

                                                  





                                             


                                            



                                                        
                                                             


                          
                                                             

                  
package config

import (
	"git.sr.ht/~rjarry/aerc/log"
	"github.com/go-ini/ini"
)

type StatuslineConfig struct {
	RenderFormat string `ini:"render-format"`
	Separator    string
	DisplayMode  string `ini:"display-mode"`
}

func defaultStatuslineConfig() *StatuslineConfig {
	return &StatuslineConfig{
		RenderFormat: "[%a] %S %>%T",
		Separator:    " | ",
		DisplayMode:  "",
	}
}

var Statusline = defaultStatuslineConfig()

func parseStatusline(file *ini.File) error {
	statusline, err := file.GetSection("statusline")
	if err != nil {
		goto out
	}
	if err := statusline.MapTo(&Statusline); err != nil {
		return err
	}
out:
	log.Debugf("aerc.conf: [statusline] %#v", Statusline)
	return nil
}