summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShivesh Mandalia <mail@shivesh.org>2021-10-24 16:00:14 +0100
committerShivesh Mandalia <mail@shivesh.org>2021-10-24 16:00:14 +0100
commitc1c8d1ff30485019323ad87c628229f1016941ac (patch)
tree5001513c329b3c4f9d52f361fa95ffa820a8aaeb
parent5c7d4873908f28dde33013d10543e4cf1417525b (diff)
downloadaerc-c1c8d1ff30485019323ad87c628229f1016941ac.tar.gz
aerc-c1c8d1ff30485019323ad87c628229f1016941ac.zip
Stylesheet colour mapping for custom IMAP flagsshivesh
-rw-r--r--config/style.go19
-rw-r--r--doc/aerc-stylesets.7.scd16
-rw-r--r--widgets/msglist.go47
3 files changed, 82 insertions, 0 deletions
diff --git a/config/style.go b/config/style.go
index c3e8503..e1c9b8d 100644
--- a/config/style.go
+++ b/config/style.go
@@ -35,6 +35,15 @@ const (
STYLE_MSGLIST_DELETED
STYLE_MSGLIST_MARKED
+ STYLE_MSGLIST_IMPORTANT
+ STYLE_MSGLIST_LIST
+ STYLE_MSGLIST_FOOD
+ STYLE_MSGLIST_PERSONAL
+ STYLE_MSGLIST_WORK
+ STYLE_MSGLIST_PHYSICS
+ STYLE_MSGLIST_TODO
+ STYLE_MSGLIST_LATER
+
STYLE_DIRLIST_DEFAULT
STYLE_COMPLETION_DEFAULT
@@ -71,6 +80,16 @@ var StyleNames = map[string]StyleObject{
"msglist_deleted": STYLE_MSGLIST_DELETED,
"msglist_marked": STYLE_MSGLIST_MARKED,
+ // NOTE(shivesh): my custom flags
+ "msglist_important": STYLE_MSGLIST_IMPORTANT,
+ "msglist_list": STYLE_MSGLIST_LIST,
+ "msglist_food": STYLE_MSGLIST_FOOD,
+ "msglist_personal": STYLE_MSGLIST_PERSONAL,
+ "msglist_work": STYLE_MSGLIST_WORK,
+ "msglist_physics": STYLE_MSGLIST_PHYSICS,
+ "msglist_todo": STYLE_MSGLIST_TODO,
+ "msglist_later": STYLE_MSGLIST_LATER,
+
"dirlist_default": STYLE_DIRLIST_DEFAULT,
"completion_default": STYLE_COMPLETION_DEFAULT,
diff --git a/doc/aerc-stylesets.7.scd b/doc/aerc-stylesets.7.scd
index 818bf69..242b2c8 100644
--- a/doc/aerc-stylesets.7.scd
+++ b/doc/aerc-stylesets.7.scd
@@ -113,6 +113,14 @@ styling.
: The messages marked as deleted.
| msglist_marked
: The messages with the marked flag.
+| msglist_important
+| msglist_list
+| msglist_food
+| msglist_personal
+| msglist_work
+| msglist_physics
+| msglist_todo
+| msglist_later
| dirlist_default
: The default style for directories in the directory list.
| completion_default
@@ -188,6 +196,14 @@ msglist_read
msglist_flagged
msglist_deleted
msglist_marked
+msglist_important
+msglist_list
+msglist_food
+msglist_personal
+msglist_work
+msglist_physics
+msglist_todo
+msglist_later
```
So, the marked style will override all other msglist styles.
diff --git a/widgets/msglist.go b/widgets/msglist.go
index 8f5a06e..90cfe33 100644
--- a/widgets/msglist.go
+++ b/widgets/msglist.go
@@ -115,12 +115,35 @@ func (ml *MessageList) Draw(ctx *ui.Context) {
// unread message
seen := false
flagged := false
+ important := false
+ list := false
+ food := false
+ personal := false
+ work := false
+ physics := false
+ todo := false
+ later := false
for _, flag := range msg.Flags {
switch flag {
case models.SeenFlag:
seen = true
case models.FlaggedFlag:
flagged = true
+ // NOTE(shivesh): my custom flags
+ case models.ImportantFlag:
+ important = true
+ case models.ListFlag:
+ list = true
+ case models.PersonalFlag:
+ personal = true
+ case models.WorkFlag:
+ work = true
+ case models.PhysicsFlag:
+ physics = true
+ case models.TodoFlag:
+ todo = true
+ case models.LaterFlag:
+ later = true
}
}
@@ -133,6 +156,30 @@ func (ml *MessageList) Draw(ctx *ui.Context) {
if flagged {
msg_styles = append(msg_styles, config.STYLE_MSGLIST_FLAGGED)
}
+ if important {
+ msg_styles = append(msg_styles, config.STYLE_MSGLIST_IMPORTANT)
+ }
+ if list {
+ msg_styles = append(msg_styles, config.STYLE_MSGLIST_LIST)
+ }
+ if food {
+ msg_styles = append(msg_styles, config.STYLE_MSGLIST_FOOD)
+ }
+ if personal {
+ msg_styles = append(msg_styles, config.STYLE_MSGLIST_PERSONAL)
+ }
+ if work {
+ msg_styles = append(msg_styles, config.STYLE_MSGLIST_WORK)
+ }
+ if physics {
+ msg_styles = append(msg_styles, config.STYLE_MSGLIST_PHYSICS)
+ }
+ if todo {
+ msg_styles = append(msg_styles, config.STYLE_MSGLIST_TODO)
+ }
+ if later {
+ msg_styles = append(msg_styles, config.STYLE_MSGLIST_LATER)
+ }
// deleted message
if _, ok := store.Deleted[msg.Uid]; ok {