From c1c8d1ff30485019323ad87c628229f1016941ac Mon Sep 17 00:00:00 2001 From: Shivesh Mandalia Date: Sun, 24 Oct 2021 16:00:14 +0100 Subject: Stylesheet colour mapping for custom IMAP flags --- widgets/msglist.go | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'widgets') 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 { -- cgit v1.2.3