aboutsummaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorDaniel Bridges <bridges2@gmail.com>2019-07-15 11:56:44 -0700
committerDrew DeVault <sir@cmpwn.com>2019-07-17 17:26:43 -0400
commitdfc048fe285939d9de3b5753f723c935d042cc2b (patch)
treeea037462fb702d0f503a34bfc8edd310d4dbfaeb /config
parentd7975132b62942530da6c4907bed3eb3ab99e4a3 (diff)
Display user specified headers in viewer if present
Diffstat (limited to 'config')
-rw-r--r--config/aerc.conf.in8
-rw-r--r--config/config.go26
2 files changed, 33 insertions, 1 deletions
diff --git a/config/aerc.conf.in b/config/aerc.conf.in
index 41f4ce6..d490831 100644
--- a/config/aerc.conf.in
+++ b/config/aerc.conf.in
@@ -61,6 +61,14 @@ alternatives=text/plain,text/html
# Default: false
show-headers=false
+#
+# Layout of headers when viewing a message. To display multiple headers in the
+# same row, separate them with a pipe, e.g. "From|To". Rows will be hidden if
+# none of their specified headers are present in the message.
+#
+# Default: From|To,Cc|Bcc,Date,Subject
+header-layout=From|To,Cc|Bcc,Date,Subject
+
[compose]
#
# Specifies the command to run the editor with. It will be shown in an embedded
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
+}