aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/aerc.conf.in6
-rw-r--r--config/config.go32
2 files changed, 38 insertions, 0 deletions
diff --git a/config/aerc.conf.in b/config/aerc.conf.in
index 08d1dbcb..1f5c87d3 100644
--- a/config/aerc.conf.in
+++ b/config/aerc.conf.in
@@ -94,6 +94,12 @@ next-message-on-delete=true
# default: @SHAREDIR@/stylesets/
stylesets-dirs=@SHAREDIR@/stylesets/
+# Uncomment to use box-drawing characters for vertical and horizontal borders.
+#
+# Default: spaces
+# border-char-vertical=│
+# border-char-horizontal=─
+
# Sets the styleset to use for the aerc ui elements.
#
# Default: default
diff --git a/config/config.go b/config/config.go
index 9be55c68..cbd5860c 100644
--- a/config/config.go
+++ b/config/config.go
@@ -53,6 +53,9 @@ type UIConfig struct {
StyleSetDirs []string `ini:"stylesets-dirs" delim:":"`
StyleSetName string `ini:"styleset-name"`
style StyleSet
+ // customize border appearance
+ BorderCharVertical rune `ini:"-"`
+ BorderCharHorizontal rune `ini:"-"`
}
type ContextType int
@@ -358,6 +361,9 @@ func (config *AercConfig) LoadConfig(file *ini.File) error {
if err := ui.MapTo(&config.Ui); err != nil {
return err
}
+ if err := validateBorderChars(ui, &config.Ui); err != nil {
+ return err
+ }
}
for _, sectionName := range file.SectionStrings() {
if !strings.Contains(sectionName, "ui:") {
@@ -372,6 +378,9 @@ func (config *AercConfig) LoadConfig(file *ini.File) error {
if err := uiSection.MapTo(&uiSubConfig); err != nil {
return err
}
+ if err := validateBorderChars(uiSection, &uiSubConfig); err != nil {
+ return err
+ }
contextualUi :=
UIConfigContext{
UiConfig: uiSubConfig,
@@ -461,6 +470,26 @@ func (config *AercConfig) LoadConfig(file *ini.File) error {
return nil
}
+func validateBorderChars(section *ini.Section, config *UIConfig) error {
+ for key, val := range section.KeysHash() {
+ switch key {
+ case "border-char-vertical":
+ char := []rune(val)
+ if len(char) != 1 {
+ return fmt.Errorf("%v must be one and only one character", key)
+ }
+ config.BorderCharVertical = char[0]
+ case "border-char-horizontal":
+ char := []rune(val)
+ if len(char) != 1 {
+ return fmt.Errorf("%v must be one and only one character", key)
+ }
+ config.BorderCharHorizontal = char[0]
+ }
+ }
+ return nil
+}
+
func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) {
if root == nil {
_root := path.Join(xdg.ConfigHome(), "aerc")
@@ -524,6 +553,9 @@ func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) {
CompletionPopovers: true,
StyleSetDirs: []string{path.Join(sharedir, "stylesets")},
StyleSetName: "default",
+ // border defaults
+ BorderCharVertical: ' ',
+ BorderCharHorizontal: ' ',
},
ContextualUis: []UIConfigContext{},