summary refs log tree commit diff stats
path: root/config
diff options
context:
space:
mode:
authorDaniel Bridges <bridges2@gmail.com>2019-07-22 16:29:07 -0700
committerDrew DeVault <sir@cmpwn.com>2019-07-26 14:22:04 -0400
commit67fb0938a66605a0b6a837005804637b348b250d (patch)
treeb9bb363185b248ae8eed29e7b8388d8a71433d3e /config
parent1b673b5ea7d06ef914e9d48ff7299f8b5f2119fd (diff)
downloadaerc-67fb0938a66605a0b6a837005804637b348b250d.tar.gz
Support configurable header layout in compose widget
Diffstat (limited to 'config')
-rw-r--r--config/aerc.conf.in7
-rw-r--r--config/config.go16
2 files changed, 22 insertions, 1 deletions
diff --git a/config/aerc.conf.in b/config/aerc.conf.in
index 5b080e9..55dfa13 100644
--- a/config/aerc.conf.in
+++ b/config/aerc.conf.in
@@ -81,6 +81,13 @@ always-show-mime=false
 # supports it. Defaults to $EDITOR, or vi.
 editor=
 
+#
+# Default header fields to display when composing a message. To display
+# multiple headers in the same row, separate them with a pipe, e.g. "To|From". 
+#
+# Default: To|From,Subject
+header-layout=To|From,Subject
+
 [filters]
 #
 # Filters allow you to pipe an email body through a shell command to render
diff --git a/config/config.go b/config/config.go
index f863729..356d562 100644
--- a/config/config.go
+++ b/config/config.go
@@ -65,7 +65,8 @@ type BindingConfig struct {
 }
 
 type ComposeConfig struct {
-	Editor string `ini:"editor"`
+	Editor       string     `ini:"editor"`
+	HeaderLayout [][]string `ini:"-"`
 }
 
 type FilterConfig struct {
@@ -278,6 +279,12 @@ func (config *AercConfig) LoadConfig(file *ini.File) error {
 		if err := compose.MapTo(&config.Compose); err != nil {
 			return err
 		}
+		for key, val := range compose.KeysHash() {
+			switch key {
+			case "header-layout":
+				config.Compose.HeaderLayout = parseLayout(val)
+			}
+		}
 	}
 	if ui, err := file.GetSection("ui"); err == nil {
 		if err := ui.MapTo(&config.Ui); err != nil {
@@ -350,6 +357,13 @@ func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) {
 				{"Subject"},
 			},
 		},
+
+		Compose: ComposeConfig{
+			HeaderLayout: [][]string{
+				{"To", "From"},
+				{"Subject"},
+			},
+		},
 	}
 	// These bindings are not configurable
 	config.Bindings.AccountWizard.ExKey = KeyStroke{