summary refs log tree commit diff stats
path: root/config/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'config/config.go')
-rw-r--r--config/config.go26
1 files changed, 25 insertions, 1 deletions
diff --git a/config/config.go b/config/config.go
index aab3905..9e081fd 100644
--- a/config/config.go
+++ b/config/config.go
@@ -79,7 +79,8 @@ type FilterConfig struct {
 type ViewerConfig struct {
 	Pager        string
 	Alternatives []string
-	ShowHeaders  bool `ini:"show-headers"`
+	ShowHeaders  bool       `ini:"show-headers"`
+	HeaderLayout [][]string `ini:"-"`
 }
 
 type AercConfig struct {
@@ -261,6 +262,8 @@ func (config *AercConfig) LoadConfig(file *ini.File) error {
 			switch key {
 			case "alternatives":
 				config.Viewer.Alternatives = strings.Split(val, ",")
+			case "header-layout":
+				config.Viewer.HeaderLayout = parseLayout(val)
 			}
 		}
 	}
@@ -323,6 +326,18 @@ func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) {
 			EmptyDirlist:      "(no folders)",
 			MouseEnabled:      false,
 		},
+
+		Viewer: ViewerConfig{
+			Pager:        "less -R",
+			Alternatives: []string{"text/plain", "text/html"},
+			ShowHeaders:  false,
+			HeaderLayout: [][]string{
+				{"From", "To"},
+				{"Cc", "Bcc"},
+				{"Date"},
+				{"Subject"},
+			},
+		},
 	}
 	// These bindings are not configurable
 	config.Bindings.AccountWizard.ExKey = KeyStroke{
@@ -431,3 +446,12 @@ func checkConfigPerms(filename string) error {
 	}
 	return nil
 }
+
+func parseLayout(layout string) [][]string {
+	rows := strings.Split(layout, ",")
+	l := make([][]string, len(rows))
+	for i, r := range rows {
+		l[i] = strings.Split(r, "|")
+	}
+	return l
+}