diff --git a/config/config.go b/config/config.go index 241e268..85ab6bf 100644 --- a/config/config.go +++ b/config/config.go @@ -158,6 +158,8 @@ type General struct { ContentProportion int TerminalTitle int ShowIcons bool + SymbolWidth int + SymbolFormat string ShowHelp bool RedrawUI bool LeaderKey rune @@ -844,6 +846,9 @@ func parseGeneral(cfg *ini.File) General { general.ShortHints = cfg.Section("general").Key("short-hints").MustBool(false) general.ShowFilterPhrase = cfg.Section("general").Key("show-filter-phrase").MustBool(true) general.ShowIcons = cfg.Section("general").Key("show-icons").MustBool(true) + general.SymbolWidth = cfg.Section("general").Key("symbol-width").MustInt(6) + symbolFormat := "%" + fmt.Sprintf("%d", general.SymbolWidth) + "s" + general.SymbolFormat = cfg.Section("general").Key("symbol-format").MustString(symbolFormat) general.ShowHelp = cfg.Section("general").Key("show-help").MustBool(true) general.RedrawUI = cfg.Section("general").Key("redraw-ui").MustBool(true) general.StickToTop = cfg.Section("general").Key("stick-to-top").MustBool(false) diff --git a/ui/item.go b/ui/item.go index d7ba959..060c587 100644 --- a/ui/item.go +++ b/ui/item.go @@ -20,12 +20,31 @@ func DrawListItem(cfg *config.Config, item api.Item) (string, string) { status := s if s.Reblog != nil { status = s.Reblog - } - if status.RepliesCount > 0 { - symbol = " ⤶ " + symbol += "♺ " } if item.Pinned() { - symbol = " ! " + symbol += "! " + } + if s.Bookmarked { + symbol += "☜ " + } + if s.Favourited { + symbol += "★ " + } + if s.Poll != nil { + symbol += "= " + } + if s.Sensitive || s.SpoilerText != "" { + symbol += "⚑ " + } + if len(s.MediaAttachments) > 0 { + symbol += "⚭ " + } + if s.Card != nil { + symbol += "⚯ " + } + if status.RepliesCount > 0 { + symbol += "⤷ " } acc := strings.TrimSpace(s.Account.Acct) if cfg.General.ShowBoostedUser && s.Reblog != nil { @@ -35,6 +54,9 @@ func DrawListItem(cfg *config.Config, item api.Item) (string, string) { acc = fmt.Sprintf("♺ %s", acc) } d := OutputDate(cfg, s.CreatedAt.Local()) + if symbol != "" { + symbol = fmt.Sprintf(cfg.General.SymbolFormat, symbol) + } return fmt.Sprintf("%s %s", d, acc), symbol case api.StatusHistoryType: s := item.Raw().(*mastodon.StatusHistory) @@ -51,19 +73,22 @@ func DrawListItem(cfg *config.Config, item api.Item) (string, string) { symbol := "" switch a.Item.Type { case "follow", "follow_request": - symbol += " + " + symbol += "+ " case "favourite": - symbol = " ★ " + symbol = "★ " case "reblog": - symbol = " ♺ " + symbol = "♺ " case "mention": - symbol = " ⤶ " + symbol = "⤶ " case "update": - symbol = " ☢ " + symbol = "☢ " case "poll": - symbol = " = " + symbol = "= " case "status": - symbol = " ⤶ " + symbol = "⤶ " + } + if symbol != "" { + symbol = fmt.Sprintf(cfg.General.SymbolFormat, symbol) } d := OutputDate(cfg, a.Item.CreatedAt.Local()) return fmt.Sprintf("%s %s", d, strings.TrimSpace(a.Item.Account.Acct)), symbol diff --git a/ui/mainview.go b/ui/mainview.go index c875c5b..cd3f87e 100644 --- a/ui/mainview.go +++ b/ui/mainview.go @@ -31,7 +31,7 @@ func (mv *MainView) ForceUpdate() { } func feedList(mv *TutView, fh *FeedHolder) *tview.Flex { - iw := 3 + iw := mv.tut.Config.General.SymbolWidth if !mv.tut.Config.General.ShowIcons { iw = 0 }