diff --git a/internal/config/config.go b/internal/config/config.go index affbc96..2cfa984 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -80,8 +80,18 @@ type ( Leaf string `toml:"leaf"` } + SidebarIndentsConfig struct { + Guild int `toml:"guild"` + Category int `toml:"category"` + Channel int `toml:"channel"` + Forum int `toml:"forum"` + GroupDM int `toml:"group_dm"` + DM int `toml:"dm"` + } + SidebarConfig struct { Markers SidebarMarkersConfig `toml:"markers"` + Indents SidebarIndentsConfig `toml:"indents"` } Config struct { diff --git a/internal/config/config.toml b/internal/config/config.toml index 0c8287e..2159a3a 100644 --- a/internal/config/config.toml +++ b/internal/config/config.toml @@ -68,6 +68,15 @@ expanded = "▾ " collapsed = "▸ " leaf = "" +# Indentation for different item types. +[sidebar.indents] +dm = 2 +group_dm = 1 +guild = 2 +category = 1 +channel = 2 +forum = 2 + [icons] guild_category = "" guild_text = "#" @@ -203,15 +212,6 @@ idle_style = { foreground = "yellow" } dnd_style = { foreground = "red" } offline_style = { foreground = "gray" } -# Guilds tree indentation for different item types -[theme.guilds_tree.indents] -dm = 2 -group_dm = 1 -guild = 2 # server inside a folder -category = 1 -channel = 2 -forum = 2 - [theme.scroll_bar] visibility = "auto" # "minimal", "box_drawing", or "unicode" diff --git a/internal/config/theme.go b/internal/config/theme.go index edd28b5..b36966e 100644 --- a/internal/config/theme.go +++ b/internal/config/theme.go @@ -205,10 +205,9 @@ type ( } GuildsTreeTheme struct { - AutoExpandFolders bool `toml:"auto_expand_folders"` - Graphics bool `toml:"graphics"` - GraphicsColor string `toml:"graphics_color"` - Indents GuildsTreeIndents `toml:"indents"` + AutoExpandFolders bool `toml:"auto_expand_folders"` + Graphics bool `toml:"graphics"` + GraphicsColor string `toml:"graphics_color"` OnlineStyle StyleWrapper `toml:"online_style"` IdleStyle StyleWrapper `toml:"idle_style"` @@ -216,15 +215,6 @@ type ( OfflineStyle StyleWrapper `toml:"offline_style"` } - GuildsTreeIndents struct { - Guild int `toml:"guild"` - Category int `toml:"category"` - Channel int `toml:"channel"` - Forum int `toml:"forum"` - GroupDM int `toml:"group_dm"` - DM int `toml:"dm"` - } - MessagesListTheme struct { ReplyIndicator string `toml:"reply_indicator"` ForwardedIndicator string `toml:"forwarded_indicator"` diff --git a/internal/ui/chat/guilds_tree.go b/internal/ui/chat/guilds_tree.go index 3fb84e8..fa0cafc 100644 --- a/internal/ui/chat/guilds_tree.go +++ b/internal/ui/chat/guilds_tree.go @@ -220,7 +220,7 @@ func (gt *guildsTree) createGuildNode(n *tview.TreeNode, guild discord.Guild) { SetReference(guild.ID). SetExpandable(true). SetExpanded(false). - SetIndent(gt.cfg.Theme.GuildsTree.Indents.Guild) + SetIndent(gt.cfg.Sidebar.Indents.Guild) gt.setNodeLineStyle(guildNode, gt.guildNodeStyle(guild.ID)) n.AddChild(guildNode) gt.guildNodeByID[guild.ID] = guildNode @@ -231,21 +231,22 @@ func (gt *guildsTree) createChannelNode(node *tview.TreeNode, channel discord.Ch return } + indents := gt.cfg.Sidebar.Indents channelNode := tview.NewTreeNode(ui.ChannelToString(channel, gt.cfg.Icons, gt.chat.state)).SetReference(channel.ID) gt.setNodeLineStyle(channelNode, gt.channelNodeStyle(channel)) switch channel.Type { case discord.DirectMessage: - channelNode.SetIndent(gt.cfg.Theme.GuildsTree.Indents.DM) + channelNode.SetIndent(indents.DM) case discord.GroupDM: - channelNode.SetIndent(gt.cfg.Theme.GuildsTree.Indents.GroupDM) + channelNode.SetIndent(indents.GroupDM) case discord.GuildCategory: - channelNode.SetIndent(gt.cfg.Theme.GuildsTree.Indents.Category) + channelNode.SetIndent(indents.Category) channelNode.SetExpandable(true).SetExpanded(true) case discord.GuildForum: - channelNode.SetIndent(gt.cfg.Theme.GuildsTree.Indents.Forum) + channelNode.SetIndent(indents.Forum) channelNode.SetExpandable(true).SetExpanded(false) default: - channelNode.SetIndent(gt.cfg.Theme.GuildsTree.Indents.Channel) + channelNode.SetIndent(indents.Channel) } node.AddChild(channelNode) gt.channelNodeByID[channel.ID] = channelNode