aboutsummaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorKalyan Sriram <coder.kalyan@gmail.com>2020-07-27 01:03:55 -0700
committerReto Brunner <reto@labrat.space>2020-08-06 21:42:06 +0200
commit905cb9dfd3ef197bb4b59039a1be76ce2c8e3099 (patch)
tree2d923c42ec224b1d525d942a7bb17416f4a62dd5 /commands
parent548a5fff68a648a5e0b6fd909e3c21463addc8af (diff)
downloadaerc-905cb9dfd3ef197bb4b59039a1be76ce2c8e3099.tar.gz
Implement style configuration.
Introduce the ability to configure stylesets, allowing customization of aerc's look (color scheme, font weight, etc). Default styleset is installed to /path/to/aerc/stylesets/default.
Diffstat (limited to 'commands')
-rw-r--r--commands/compose/attach.go5
-rw-r--r--commands/compose/detach.go5
-rw-r--r--commands/exec.go15
-rw-r--r--commands/msg/pipe.go14
4 files changed, 16 insertions, 23 deletions
diff --git a/commands/compose/attach.go b/commands/compose/attach.go
index 2b633dc6..148442b0 100644
--- a/commands/compose/attach.go
+++ b/commands/compose/attach.go
@@ -4,11 +4,9 @@ import (
"fmt"
"os"
"strings"
- "time"
"git.sr.ht/~sircmpwn/aerc/commands"
"git.sr.ht/~sircmpwn/aerc/widgets"
- "github.com/gdamore/tcell"
"github.com/mitchellh/go-homedir"
)
@@ -52,8 +50,7 @@ func (Attach) Execute(aerc *widgets.Aerc, args []string) error {
composer, _ := aerc.SelectedTab().(*widgets.Composer)
composer.AddAttachment(path)
- aerc.PushStatus(fmt.Sprintf("Attached %s", pathinfo.Name()), 10*time.Second).
- Color(tcell.ColorDefault, tcell.ColorGreen)
+ aerc.PushSuccess(fmt.Sprintf("Attached %s", pathinfo.Name()))
return nil
}
diff --git a/commands/compose/detach.go b/commands/compose/detach.go
index e8b07ed6..b48159d0 100644
--- a/commands/compose/detach.go
+++ b/commands/compose/detach.go
@@ -3,10 +3,8 @@ package compose
import (
"fmt"
"strings"
- "time"
"git.sr.ht/~sircmpwn/aerc/widgets"
- "github.com/gdamore/tcell"
)
type Detach struct{}
@@ -44,8 +42,7 @@ func (Detach) Execute(aerc *widgets.Aerc, args []string) error {
return err
}
- aerc.PushStatus(fmt.Sprintf("Detached %s", path), 10*time.Second).
- Color(tcell.ColorDefault, tcell.ColorGreen)
+ aerc.PushSuccess(fmt.Sprintf("Detached %s", path))
return nil
}
diff --git a/commands/exec.go b/commands/exec.go
index 771c528e..c9aba68f 100644
--- a/commands/exec.go
+++ b/commands/exec.go
@@ -8,8 +8,6 @@ import (
"time"
"git.sr.ht/~sircmpwn/aerc/widgets"
-
- "github.com/gdamore/tcell"
)
type ExecCmd struct{}
@@ -51,14 +49,15 @@ func (ExecCmd) Execute(aerc *widgets.Aerc, args []string) error {
if err != nil {
aerc.PushError(" " + err.Error())
} else {
- color := tcell.ColorDefault
if cmd.ProcessState.ExitCode() != 0 {
- color = tcell.ColorRed
+ aerc.PushError(fmt.Sprintf(
+ "%s: completed with status %d", args[0],
+ cmd.ProcessState.ExitCode()))
+ } else {
+ aerc.PushStatus(fmt.Sprintf(
+ "%s: completed with status %d", args[0],
+ cmd.ProcessState.ExitCode()), 10*time.Second)
}
- aerc.PushStatus(fmt.Sprintf(
- "%s: completed with status %d", args[0],
- cmd.ProcessState.ExitCode()), 10*time.Second).
- Color(tcell.ColorDefault, color)
}
}()
return nil
diff --git a/commands/msg/pipe.go b/commands/msg/pipe.go
index 20cb8b46..4e4ba67d 100644
--- a/commands/msg/pipe.go
+++ b/commands/msg/pipe.go
@@ -12,7 +12,6 @@ import (
"git.sr.ht/~sircmpwn/aerc/worker/types"
"git.sr.ht/~sircmpwn/getopt"
- "github.com/gdamore/tcell"
)
type Pipe struct{}
@@ -96,14 +95,15 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error {
if err != nil {
aerc.PushError(" " + err.Error())
} else {
- color := tcell.ColorDefault
if ecmd.ProcessState.ExitCode() != 0 {
- color = tcell.ColorRed
+ aerc.PushError(fmt.Sprintf(
+ "%s: completed with status %d", cmd[0],
+ ecmd.ProcessState.ExitCode()))
+ } else {
+ aerc.PushStatus(fmt.Sprintf(
+ "%s: completed with status %d", cmd[0],
+ ecmd.ProcessState.ExitCode()), 10*time.Second)
}
- aerc.PushStatus(fmt.Sprintf(
- "%s: completed with status %d", cmd[0],
- ecmd.ProcessState.ExitCode()), 10*time.Second).
- Color(tcell.ColorDefault, color)
}
}