diff --git a/config.example.ini b/config.example.ini index 316dbe9..8be6e52 100644 --- a/config.example.ini +++ b/config.example.ini @@ -115,6 +115,12 @@ show-filter-phrase=true # default=true show-help=true +# 0 = No terminal title +# 1 = Show title in terminal and top bar +# 2 = Only show terminal title, and no top bar in tut. +# default=0 +terminal-title=0 + # If you don't want the whole UI to update, and only the text content you can # set this option to true. This will lead to some artifacts being left on the # screen when emojis are present. But it will keep the UI from flashing on every @@ -341,60 +347,110 @@ xrdb-prefix=guess theme=default # The background color used on most elements. -# default=xrdb:background -background=xrdb:background +# default= +background= # The text color used on most of the text. -# default=xrdb:foreground -text=xrdb:foreground +# default= +text= # The color to display sublte elements or subtle text. Like lines and help text. -# default=xrdb:color14 -subtle=xrdb:color14 +# default= +subtle= # The color for errors or warnings -# default=xrdb:color1 -warning-text=xrdb:color1 +# default= +warning-text= # This color is used to display username. -# default=xrdb:color5 -text-special-one=xrdb:color5 +# default= +text-special-one= # This color is used to display username and key hints. -# default=xrdb:color2 -text-special-two=xrdb:color2 +# default= +text-special-two= # The color of the bar at the top -# default=xrdb:color5 -top-bar-background=xrdb:color5 +# default= +top-bar-background= # The color of the text in the bar at the top. -# default=xrdb:background -top-bar-text=xrdb:background +# default= +top-bar-text= # The color of the bar at the bottom -# default=xrdb:color5 -status-bar-background=xrdb:color5 +# default= +status-bar-background= # The color of the text in the bar at the bottom. -# default=xrdb:foreground -status-bar-text=xrdb:foreground +# default= +status-bar-text= # The color of the bar at the bottom in view mode. -# default=xrdb:color4 -status-bar-view-background=xrdb:color4 +# default= +status-bar-view-background= # The color of the text in the bar at the bottom in view mode. -# default=xrdb:foreground -status-bar-view-text=xrdb:foreground +# default= +status-bar-view-text= # Background of selected list items. -# default=xrdb:color5 -list-selected-background=xrdb:color5 +# default= +list-selected-background= # The text color of selected list items. -# default=xrdb:background -list-selected-text=xrdb:background +# default= +list-selected-text= + +# The background color of selected list items that are out of focus. +# default= +list-selected-inactive-background= + +# The text color of selected list items that are out of focus. +# default= +list-selected-inactive-text= + +# The main color of the text for key hints +# default= +controls-text= + +# The highlight color of for key hints +# default= +controls-highlight= + +# The background color in dropdowns and autocompletions +# default= +autocomplete-background= + +# The text color in dropdowns at autocompletions +# default= +autocomplete-text= + +# The background color for selected value in dropdowns and autocompletions +# default= +autocomplete-selected-background= + +# The text color for selected value in dropdowns and autocompletions +# default= +autocomplete-selected-text= + +# The background color on selected button and the text color of unselected +# buttons +# default= +button-color-one= + +# The text color on selected button and the background color of unselected +# buttons +# default= +button-color-two= + +# The background on named timelines. +# default= +timeline-name-background= + +# The text color on named timelines +# default= +timeline-name-text= [input] # You can edit the keys for tut below. diff --git a/config/config.go b/config/config.go index 62dd8e1..c4a9da8 100644 --- a/config/config.go +++ b/config/config.go @@ -102,6 +102,7 @@ type General struct { ListSplit ListSplit ListProportion int ContentProportion int + TerminalTitle int ShowIcons bool ShowHelp bool RedrawUI bool @@ -135,6 +136,26 @@ type Style struct { ListSelectedBackground tcell.Color ListSelectedText tcell.Color + + ListSelectedInactiveBackground tcell.Color + ListSelectedInactiveText tcell.Color + + ControlsText tcell.Color + ControlsHighlight tcell.Color + + AutocompleteBackground tcell.Color + AutocompleteText tcell.Color + + AutocompleteSelectedBackground tcell.Color + AutocompleteSelectedText tcell.Color + + ButtonColorOne tcell.Color + ButtonColorTwo tcell.Color + + TimelineNameBackground tcell.Color + TimelineNameText tcell.Color + + IconColor tcell.Color } type Media struct { @@ -461,89 +482,250 @@ func parseStyle(cfg *ini.File) Style { if err != nil { log.Fatalf("Couldn't load theme. Error: %s\n", err) } - bg := tcfg.Section("").Key("background").String() - style.Background = parseColor(bg, "default", xrdbColors) + s := tcfg.Section("").Key("background").String() + style.Background = parseColor(s, "default", xrdbColors) + + s = tcfg.Section("").Key("text").String() + style.Text = tcell.GetColor(s) + + s = tcfg.Section("").Key("subtle").String() + style.Subtle = tcell.GetColor(s) - text := tcfg.Section("").Key("text").String() - style.Text = tcell.GetColor(text) + s = tcfg.Section("").Key("warning-text").String() + style.WarningText = tcell.GetColor(s) - subtle := tcfg.Section("").Key("subtle").String() - style.Subtle = tcell.GetColor(subtle) + s = tcfg.Section("").Key("text-special-one").String() + style.TextSpecial1 = tcell.GetColor(s) - warningText := tcfg.Section("").Key("warning-text").String() - style.WarningText = tcell.GetColor(warningText) + s = tcfg.Section("").Key("text-special-two").String() + style.TextSpecial2 = tcell.GetColor(s) - textSpecial1 := tcfg.Section("").Key("text-special-one").String() - style.TextSpecial1 = tcell.GetColor(textSpecial1) + s = tcfg.Section("").Key("top-bar-background").String() + style.TopBarBackground = tcell.GetColor(s) - textSpecial2 := tcfg.Section("").Key("text-special-two").String() - style.TextSpecial2 = tcell.GetColor(textSpecial2) + s = tcfg.Section("").Key("top-bar-text").String() + style.TopBarText = tcell.GetColor(s) - topBarBackround := tcfg.Section("").Key("top-bar-background").String() - style.TopBarBackground = tcell.GetColor(topBarBackround) + s = tcfg.Section("").Key("status-bar-background").String() + style.StatusBarBackground = tcell.GetColor(s) - topBarText := tcfg.Section("").Key("top-bar-text").String() - style.TopBarText = tcell.GetColor(topBarText) + s = tcfg.Section("").Key("status-bar-text").String() + style.StatusBarText = tcell.GetColor(s) - statusBarBackround := tcfg.Section("").Key("status-bar-background").String() - style.StatusBarBackground = tcell.GetColor(statusBarBackround) + s = tcfg.Section("").Key("status-bar-view-background").String() + style.StatusBarViewBackground = tcell.GetColor(s) - statusBarText := tcfg.Section("").Key("status-bar-text").String() - style.StatusBarText = tcell.GetColor(statusBarText) + s = tcfg.Section("").Key("status-bar-view-text").String() + style.StatusBarViewText = tcell.GetColor(s) - statusBarViewBackround := tcfg.Section("").Key("status-bar-view-background").String() - style.StatusBarViewBackground = tcell.GetColor(statusBarViewBackround) + s = tcfg.Section("").Key("list-selected-background").String() + style.ListSelectedBackground = tcell.GetColor(s) - statusBarViewText := tcfg.Section("").Key("status-bar-view-text").String() - style.StatusBarViewText = tcell.GetColor(statusBarViewText) + s = tcfg.Section("").Key("list-selected-text").String() + style.ListSelectedText = tcell.GetColor(s) - listSelectedBackground := tcfg.Section("").Key("list-selected-background").String() - style.ListSelectedBackground = tcell.GetColor(listSelectedBackground) + s = tcfg.Section("").Key("list-selected-inactive-background").String() + if len(s) > 0 { + style.ListSelectedInactiveBackground = tcell.GetColor(s) + } else { + style.ListSelectedInactiveBackground = style.StatusBarViewBackground + } + s = tcfg.Section("").Key("list-selected-inactive-text").String() + if len(s) > 0 { + style.ListSelectedInactiveText = tcell.GetColor(s) + } else { + style.ListSelectedInactiveText = style.StatusBarViewText + } + + s = tcfg.Section("").Key("controls-highlight").String() + if len(s) > 0 { + style.ControlsHighlight = tcell.GetColor(s) + } else { + style.ControlsHighlight = style.TextSpecial2 + } + + s = tcfg.Section("").Key("controls-text").String() + if len(s) > 0 { + style.ControlsText = tcell.GetColor(s) + } else { + style.ControlsText = style.Text + } + s = tcfg.Section("").Key("controls-highlight").String() + if len(s) > 0 { + style.ControlsHighlight = tcell.GetColor(s) + } else { + style.ControlsHighlight = style.TextSpecial2 + } + + s = tcfg.Section("").Key("autocomplete-background").String() + if len(s) > 0 { + style.AutocompleteBackground = tcell.GetColor(s) + } else { + style.AutocompleteBackground = style.Background + } + s = tcfg.Section("").Key("autocomplete-text").String() + if len(s) > 0 { + style.AutocompleteText = tcell.GetColor(s) + } else { + style.AutocompleteText = style.Text + } + s = tcfg.Section("").Key("autocomplete-selected-background").String() + if len(s) > 0 { + style.AutocompleteSelectedBackground = tcell.GetColor(s) + } else { + style.AutocompleteSelectedBackground = style.StatusBarViewBackground + } + s = tcfg.Section("").Key("autocomplete-selected-text").String() + if len(s) > 0 { + style.AutocompleteSelectedText = tcell.GetColor(s) + } else { + style.AutocompleteSelectedText = style.StatusBarViewText + } + + s = tcfg.Section("").Key("button-color-one").String() + if len(s) > 0 { + style.ButtonColorOne = tcell.GetColor(s) + } else { + style.ButtonColorOne = style.StatusBarViewBackground + } + s = tcfg.Section("").Key("button-color-two").String() + if len(s) > 0 { + style.ButtonColorTwo = tcell.GetColor(s) + } else { + style.ButtonColorTwo = style.Background + } - listSelectedText := tcfg.Section("").Key("list-selected-text").String() - style.ListSelectedText = tcell.GetColor(listSelectedText) + s = tcfg.Section("").Key("timeline-name-background").String() + if len(s) > 0 { + style.TimelineNameBackground = tcell.GetColor(s) + } else { + style.TimelineNameBackground = style.Background + } + s = tcfg.Section("").Key("timeline-name-text").String() + if len(s) > 0 { + style.TimelineNameText = tcell.GetColor(s) + } else { + style.TimelineNameText = style.Subtle + } } else { - bg := cfg.Section("style").Key("background").String() - style.Background = parseColor(bg, "default", xrdbColors) + s := cfg.Section("style").Key("background").String() + style.Background = parseColor(s, "#27822", xrdbColors) + + s = cfg.Section("style").Key("text").String() + style.Text = parseColor(s, "#f8f8f2", xrdbColors) - text := cfg.Section("style").Key("text").String() - style.Text = parseColor(text, "white", xrdbColors) + s = cfg.Section("style").Key("subtle").String() + style.Subtle = parseColor(s, "#808080", xrdbColors) - subtle := cfg.Section("style").Key("subtle").String() - style.Subtle = parseColor(subtle, "gray", xrdbColors) + s = cfg.Section("style").Key("warning-text").String() + style.WarningText = parseColor(s, "#f92672", xrdbColors) - warningText := cfg.Section("style").Key("warning-text").String() - style.WarningText = parseColor(warningText, "#f92672", xrdbColors) + s = cfg.Section("style").Key("text-special-one").String() + style.TextSpecial1 = parseColor(s, "#ae81ff", xrdbColors) - textSpecial1 := cfg.Section("style").Key("text-special-one").String() - style.TextSpecial1 = parseColor(textSpecial1, "#ae81ff", xrdbColors) + s = cfg.Section("style").Key("text-special-two").String() + style.TextSpecial2 = parseColor(s, "#a6e22e", xrdbColors) - textSpecial2 := cfg.Section("style").Key("text-special-two").String() - style.TextSpecial2 = parseColor(textSpecial2, "#a6e22e", xrdbColors) + s = cfg.Section("style").Key("top-bar-background").String() + style.TopBarBackground = parseColor(s, "#f92672", xrdbColors) - topBarBackround := cfg.Section("style").Key("top-bar-background").String() - style.TopBarBackground = parseColor(topBarBackround, "#f92672", xrdbColors) + s = cfg.Section("style").Key("top-bar-text").String() + style.TopBarText = parseColor(s, "white", xrdbColors) - topBarText := cfg.Section("style").Key("top-bar-text").String() - style.TopBarText = parseColor(topBarText, "white", xrdbColors) + s = cfg.Section("style").Key("status-bar-background").String() + style.StatusBarBackground = parseColor(s, "#f92672", xrdbColors) - statusBarBackround := cfg.Section("style").Key("status-bar-background").String() - style.StatusBarBackground = parseColor(statusBarBackround, "#f92672", xrdbColors) + s = cfg.Section("style").Key("status-bar-text").String() + style.StatusBarText = parseColor(s, "white", xrdbColors) - statusBarText := cfg.Section("style").Key("status-bar-text").String() - style.StatusBarText = parseColor(statusBarText, "white", xrdbColors) + s = cfg.Section("style").Key("status-bar-view-background").String() + style.StatusBarViewBackground = parseColor(s, "#ae81ff", xrdbColors) - statusBarViewBackround := cfg.Section("style").Key("status-bar-view-background").String() - style.StatusBarViewBackground = parseColor(statusBarViewBackround, "#ae81ff", xrdbColors) + s = cfg.Section("style").Key("status-bar-view-text").String() + style.StatusBarViewText = parseColor(s, "white", xrdbColors) - statusBarViewText := cfg.Section("style").Key("status-bar-view-text").String() - style.StatusBarViewText = parseColor(statusBarViewText, "white", xrdbColors) + s = cfg.Section("style").Key("list-selected-background").String() + style.ListSelectedBackground = parseColor(s, "#f92672", xrdbColors) + + s = cfg.Section("style").Key("list-selected-text").String() + style.ListSelectedText = parseColor(s, "white", xrdbColors) + + s = cfg.Section("style").Key("list-selected-inactive-background").String() + if len(s) > 0 { + style.ListSelectedInactiveBackground = parseColor(s, "#ae81ff", xrdbColors) + } else { + style.ListSelectedInactiveBackground = style.StatusBarViewBackground + } + s = cfg.Section("style").Key("list-selected-inactive-text").String() + if len(s) > 0 { + style.ListSelectedInactiveText = parseColor(s, "#f8f8f2", xrdbColors) + } else { + style.ListSelectedInactiveText = style.StatusBarViewText + } - listSelectedBackground := cfg.Section("style").Key("list-selected-background").String() - style.ListSelectedBackground = parseColor(listSelectedBackground, "#f92672", xrdbColors) + s = cfg.Section("style").Key("controls-text").String() + if len(s) > 0 { + style.ControlsText = parseColor(s, "#f8f8f2", xrdbColors) + } else { + style.ControlsText = style.Text + } + s = cfg.Section("style").Key("controls-highlight").String() + if len(s) > 0 { + style.ControlsHighlight = parseColor(s, "#a6e22e", xrdbColors) + } else { + style.ControlsHighlight = style.TextSpecial2 + } - listSelectedText := cfg.Section("style").Key("list-selected-text").String() - style.ListSelectedText = parseColor(listSelectedText, "white", xrdbColors) + s = cfg.Section("style").Key("autocomplete-background").String() + if len(s) > 0 { + style.AutocompleteBackground = parseColor(s, "#272822", xrdbColors) + } else { + style.AutocompleteBackground = style.Background + } + s = cfg.Section("style").Key("autocomplete-text").String() + if len(s) > 0 { + style.AutocompleteText = parseColor(s, "#f8f8f2", xrdbColors) + } else { + style.AutocompleteText = style.Text + } + s = cfg.Section("style").Key("autocomplete-selected-background").String() + if len(s) > 0 { + style.AutocompleteSelectedBackground = parseColor(s, "#ae81ff", xrdbColors) + } else { + style.AutocompleteSelectedBackground = style.StatusBarViewBackground + } + s = cfg.Section("style").Key("autocomplete-selected-text").String() + if len(s) > 0 { + style.AutocompleteSelectedText = parseColor(s, "#f8f8f2", xrdbColors) + } else { + style.AutocompleteSelectedText = style.StatusBarViewText + } + + s = cfg.Section("style").Key("button-color-one").String() + if len(s) > 0 { + style.ButtonColorOne = parseColor(s, "#ae81ff", xrdbColors) + } else { + style.ButtonColorOne = style.StatusBarViewBackground + } + s = cfg.Section("style").Key("button-color-two").String() + if len(s) > 0 { + style.ButtonColorTwo = parseColor(s, "#272822", xrdbColors) + } else { + style.ButtonColorTwo = style.Background + } + + s = cfg.Section("style").Key("timeline-name-background").String() + if len(s) > 0 { + style.TimelineNameBackground = parseColor(s, "#272822", xrdbColors) + } else { + style.TimelineNameBackground = style.Background + } + s = cfg.Section("style").Key("timeline-name-text").String() + if len(s) > 0 { + style.TimelineNameText = parseColor(s, "gray", xrdbColors) + } else { + style.TimelineNameText = style.Subtle + } } return style @@ -794,6 +976,16 @@ func parseGeneral(cfg *ini.File) General { } general.Timelines = tls + general.TerminalTitle = cfg.Section("general").Key("terminal-title").MustInt(0) + /* + 0 = No terminal title + 1 = Show title in terminal and top bar + 2 = Only show terminal title, and no top bar + */ + if general.TerminalTitle < 0 || general.TerminalTitle > 2 { + general.TerminalTitle = 0 + } + return general } diff --git a/config/default_config.go b/config/default_config.go index b3fdb51..7051f7d 100644 --- a/config/default_config.go +++ b/config/default_config.go @@ -117,6 +117,12 @@ show-filter-phrase=true # default=true show-help=true +# 0 = No terminal title +# 1 = Show title in terminal and top bar +# 2 = Only show terminal title, and no top bar in tut. +# default=0 +terminal-title=0 + # If you don't want the whole UI to update, and only the text content you can # set this option to true. This will lead to some artifacts being left on the # screen when emojis are present. But it will keep the UI from flashing on every @@ -343,60 +349,110 @@ xrdb-prefix=guess theme=default # The background color used on most elements. -# default=xrdb:background -background=xrdb:background +# default= +background= # The text color used on most of the text. -# default=xrdb:foreground -text=xrdb:foreground +# default= +text= # The color to display sublte elements or subtle text. Like lines and help text. -# default=xrdb:color14 -subtle=xrdb:color14 +# default= +subtle= # The color for errors or warnings -# default=xrdb:color1 -warning-text=xrdb:color1 +# default= +warning-text= # This color is used to display username. -# default=xrdb:color5 -text-special-one=xrdb:color5 +# default= +text-special-one= # This color is used to display username and key hints. -# default=xrdb:color2 -text-special-two=xrdb:color2 +# default= +text-special-two= # The color of the bar at the top -# default=xrdb:color5 -top-bar-background=xrdb:color5 +# default= +top-bar-background= # The color of the text in the bar at the top. -# default=xrdb:background -top-bar-text=xrdb:background +# default= +top-bar-text= # The color of the bar at the bottom -# default=xrdb:color5 -status-bar-background=xrdb:color5 +# default= +status-bar-background= # The color of the text in the bar at the bottom. -# default=xrdb:foreground -status-bar-text=xrdb:foreground +# default= +status-bar-text= # The color of the bar at the bottom in view mode. -# default=xrdb:color4 -status-bar-view-background=xrdb:color4 +# default= +status-bar-view-background= # The color of the text in the bar at the bottom in view mode. -# default=xrdb:foreground -status-bar-view-text=xrdb:foreground +# default= +status-bar-view-text= # Background of selected list items. -# default=xrdb:color5 -list-selected-background=xrdb:color5 +# default= +list-selected-background= # The text color of selected list items. -# default=xrdb:background -list-selected-text=xrdb:background +# default= +list-selected-text= + +# The background color of selected list items that are out of focus. +# default= +list-selected-inactive-background= + +# The text color of selected list items that are out of focus. +# default= +list-selected-inactive-text= + +# The main color of the text for key hints +# default= +controls-text= + +# The highlight color of for key hints +# default= +controls-highlight= + +# The background color in dropdowns and autocompletions +# default= +autocomplete-background= + +# The text color in dropdowns at autocompletions +# default= +autocomplete-text= + +# The background color for selected value in dropdowns and autocompletions +# default= +autocomplete-selected-background= + +# The text color for selected value in dropdowns and autocompletions +# default= +autocomplete-selected-text= + +# The background color on selected button and the text color of unselected +# buttons +# default= +button-color-one= + +# The text color on selected button and the background color of unselected +# buttons +# default= +button-color-two= + +# The background on named timelines. +# default= +timeline-name-background= + +# The text color on named timelines +# default= +timeline-name-text= [input] # You can edit the keys for tut below. diff --git a/config/keys.go b/config/keys.go index af8be2a..5f41e7c 100644 --- a/config/keys.go +++ b/config/keys.go @@ -21,8 +21,8 @@ func ColorFromKey(c *Config, k Key, first bool) string { } func ColorKey(c *Config, pre, key, end string) string { - color := ColorMark(c.Style.TextSpecial2) - normal := ColorMark(c.Style.Text) + color := ColorMark(c.Style.ControlsHighlight) + normal := ColorMark(c.Style.ControlsText) key = TextFlags("b") + key + TextFlags("-") if c.General.ShortHints { pre = "" diff --git a/config/themes/default.ini b/config/themes/default.ini index e12d882..a1ce9b3 100644 --- a/config/themes/default.ini +++ b/config/themes/default.ini @@ -1,6 +1,6 @@ background=#272822 text=#f8f8f2 -subtle=gray +subtle=#808080 warning-text=#f92672 text-special-one=#ae81ff text-special-two=#a6e22e @@ -12,3 +12,16 @@ status-bar-view-background=#ae81ff status-bar-view-text=#f8f8f2 list-selected-background=#f92672 list-selected-text=#f8f8f2 +list-selected-inactive-background=#ae81ff +list-selected-inactive-text=#f8f8f2 +controls-text=#f8f8f2 +controls-highlight=#a6e22e +autocomplete-background=#272822 +autocomplete-text=#f8f8f2 +autocomplete-selected-background=#ae81ff +autocomplete-selected-text=#f8f8f2 +button-color-one=#f92672 +button-color-two=#272822 +timeline-name-background=#272822 +timeline-name-text=#808080 + diff --git a/go.sum b/go.sum index 689f791..5270a91 100644 --- a/go.sum +++ b/go.sum @@ -29,27 +29,19 @@ github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69 github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/microcosm-cc/bluemonday v1.0.18 h1:6HcxvXDAi3ARt3slx6nTesbvorIc3QeTzBNRvWktHBo= -github.com/microcosm-cc/bluemonday v1.0.18/go.mod h1:Z0r70sCuXHig8YpBzCc5eGHAap2K7e/u082ZUpDRRqM= github.com/microcosm-cc/bluemonday v1.0.19 h1:OI7hoF5FY4pFz2VA//RN8TfM0YJ2dJcl4P4APrCWy6c= github.com/microcosm-cc/bluemonday v1.0.19/go.mod h1:QNzV2UbLK2/53oIIwTOyLUSABMkjZ4tqiyC1g/DyqxE= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= -github.com/pelletier/go-toml/v2 v2.0.1 h1:8e3L2cCQzLFi2CR4g7vGFuFxX7Jl1kKX8gW+iV0GUKU= -github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= github.com/pelletier/go-toml/v2 v2.0.2 h1:+jQXlF3scKIcSEKkdHzXhCTDLPFi5r1wnK6yPS+49Gw= github.com/pelletier/go-toml/v2 v2.0.2/go.mod h1:MovirKjgVRESsAvNZlAjtFwV867yGuwRkXbG66OzopI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rivo/tview v0.0.0-20220307222120-9994674d60a8 h1:xe+mmCnDN82KhC010l3NfYlA8ZbOuzbXAzSYBa6wbMc= -github.com/rivo/tview v0.0.0-20220307222120-9994674d60a8/go.mod h1:WIfMkQNY+oq/mWwtsjOYHIZBuwthioY2srOmljJkTnk= github.com/rivo/tview v0.0.0-20220709181631-73bf2902b59a h1:ZjJ1XcvsZkNVO+Rq/vQTOXtN3cmuAgpCp8m4fKG5CkY= github.com/rivo/tview v0.0.0-20220709181631-73bf2902b59a/go.mod h1:WIfMkQNY+oq/mWwtsjOYHIZBuwthioY2srOmljJkTnk= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af h1:6yITBqGTE2lEeTPG04SN9W+iWHCRyHqlVYILiSXziwk= @@ -57,8 +49,6 @@ github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af/go.mod h1:4F09kP5F+a github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 h1:nrZ3ySNYwJbSpD6ce9duiP+QkD3JuLCcWkdaehUS/3Y= github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80/go.mod h1:iFyPdL66DjUD96XmzVL3ZntbzcflLnznH0fr99w5VqE= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220531201128-c960675eff93 h1:MYimHLfoXEpOhqd/zgoA/uoXzHB86AEky4LAx5ij9xA= -golang.org/x/net v0.0.0-20220531201128-c960675eff93/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220708220712-1185a9018129 h1:vucSRfWwTsoXro7P+3Cjlr6flUMtzCwzlvkxEQtHHB0= golang.org/x/net v0.0.0-20220708220712-1185a9018129/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -67,7 +57,6 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220318055525-2edf467146b5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -85,6 +74,5 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/ini.v1 v1.66.6 h1:LATuAqN/shcYAOkv3wl2L4rkaKqkcgTBQjOyYDvcPKI= gopkg.in/ini.v1 v1.66.6/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/main.go b/main.go index 6336c2b..a21269e 100644 --- a/main.go +++ b/main.go @@ -8,9 +8,10 @@ import ( "github.com/rivo/tview" ) -const version = "1.0.13" +const version = "1.0.14" func main() { + util.SetTerminalTitle("tut") util.MakeDirs() newUser, selectedUser := ui.CliView(version) accs := auth.StartAuth(newUser) diff --git a/ui/composeview.go b/ui/composeview.go index 4a3d19e..8b83fb6 100644 --- a/ui/composeview.go +++ b/ui/composeview.go @@ -71,19 +71,22 @@ func NewComposeView(tv *TutView) *ComposeView { } func newComposeUI(cv *ComposeView) *tview.Flex { - return tview.NewFlex().SetDirection(tview.FlexRow). - AddItem(cv.tutView.Shared.Top.View, 1, 0, false). - AddItem(tview.NewFlex().SetDirection(tview.FlexColumn). - AddItem(tview.NewFlex().SetDirection(tview.FlexRow). - AddItem(cv.content, 0, 2, false), 0, 2, false). - AddItem(tview.NewBox(), 2, 0, false). - AddItem(tview.NewFlex().SetDirection(tview.FlexRow). - AddItem(cv.visibility, 1, 0, false). - AddItem(cv.info, 5, 0, false). - AddItem(cv.media.View, 0, 1, false), 0, 1, false), 0, 1, false). + r := tview.NewFlex().SetDirection(tview.FlexRow) + if cv.tutView.tut.Config.General.TerminalTitle < 2 { + r.AddItem(cv.tutView.Shared.Top.View, 1, 0, false) + } + r.AddItem(tview.NewFlex().SetDirection(tview.FlexColumn). + AddItem(tview.NewFlex().SetDirection(tview.FlexRow). + AddItem(cv.content, 0, 2, false), 0, 2, false). + AddItem(tview.NewBox(), 2, 0, false). + AddItem(tview.NewFlex().SetDirection(tview.FlexRow). + AddItem(cv.visibility, 1, 0, false). + AddItem(cv.info, 5, 0, false). + AddItem(cv.media.View, 0, 1, false), 0, 1, false), 0, 1, false). AddItem(cv.input.View, 1, 0, false). AddItem(cv.controls, 1, 0, false). AddItem(cv.tutView.Shared.Bottom.View, 2, 0, false) + return r } type ComposeControls uint diff --git a/ui/feed.go b/ui/feed.go index 689c5af..fb04867 100644 --- a/ui/feed.go +++ b/ui/feed.go @@ -39,8 +39,8 @@ func (fl *FeedList) OutFocus(style config.Style) { func outFocus(l *tview.List, style config.Style) { l.SetBackgroundColor(style.Background) l.SetMainTextColor(style.Text) - l.SetSelectedBackgroundColor(style.StatusBarViewBackground) - l.SetSelectedTextColor(style.StatusBarViewText) + l.SetSelectedBackgroundColor(style.ListSelectedInactiveBackground) + l.SetSelectedTextColor(style.ListSelectedInactiveText) } type Feed struct { diff --git a/ui/helpview.go b/ui/helpview.go index beaee77..d7882c6 100644 --- a/ui/helpview.go +++ b/ui/helpview.go @@ -46,9 +46,12 @@ func NewHelpView(tv *TutView) *HelpView { } func newHelpViewUI(hv *HelpView) *tview.Flex { - return tview.NewFlex().SetDirection(tview.FlexRow). - AddItem(hv.shared.Top.View, 1, 0, false). - AddItem(hv.content, 0, 1, false). + r := tview.NewFlex().SetDirection(tview.FlexRow) + if hv.tutView.tut.Config.General.TerminalTitle < 2 { + r.AddItem(hv.shared.Top.View, 1, 0, false) + } + r.AddItem(hv.content, 0, 1, false). AddItem(hv.controls, 1, 0, false). AddItem(hv.shared.Bottom.View, 2, 0, false) + return r } diff --git a/ui/linkview.go b/ui/linkview.go index 5f22706..36e4cb9 100644 --- a/ui/linkview.go +++ b/ui/linkview.go @@ -41,11 +41,14 @@ func linkViewUI(lv *LinkView) *tview.Flex { res := strings.Join(items, " ") lv.controls.SetText(res) - return tview.NewFlex().SetDirection(tview.FlexRow). - AddItem(lv.shared.Top.View, 1, 0, false). - AddItem(lv.list, 0, 1, false). + r := tview.NewFlex().SetDirection(tview.FlexRow) + if lv.tutView.tut.Config.General.TerminalTitle < 2 { + r.AddItem(lv.shared.Top.View, 1, 0, false) + } + r.AddItem(lv.list, 0, 1, false). AddItem(lv.controls, 1, 0, false). AddItem(lv.shared.Bottom.View, 2, 0, false) + return r } func (lv *LinkView) SetLinks() { diff --git a/ui/loginview.go b/ui/loginview.go index a0e2cad..b3411d9 100644 --- a/ui/loginview.go +++ b/ui/loginview.go @@ -21,9 +21,11 @@ func NewLoginView(tv *TutView, accs *auth.AccountData) *LoginView { list.AddItem(fmt.Sprintf("%s - %s", a.Name, a.Server), "", 0, nil) } - v := tview.NewFlex().SetDirection(tview.FlexRow). - AddItem(tv.Shared.Top.View, 1, 0, false). - AddItem(list, 0, 1, false). + v := tview.NewFlex().SetDirection(tview.FlexRow) + if tv.tut.Config.General.TerminalTitle < 2 { + v.AddItem(tv.Shared.Top.View, 1, 0, false) + } + v.AddItem(list, 0, 1, false). AddItem(tv.Shared.Bottom.View, 2, 0, false) return &LoginView{ diff --git a/ui/mainview.go b/ui/mainview.go index f001354..c875c5b 100644 --- a/ui/mainview.go +++ b/ui/mainview.go @@ -58,7 +58,8 @@ func mainViewUI(mv *TutView) *tview.Flex { if mv.tut.Config.General.TimelineName && len(fh.Name) > 0 { txt := NewTextView(mv.tut.Config) txt.SetText(tview.Escape(fh.Name)) - txt.SetTextColor(mv.tut.Config.Style.Subtle) + txt.SetBackgroundColor(mv.tut.Config.Style.TimelineNameBackground) + txt.SetTextColor(mv.tut.Config.Style.TimelineNameText) feeds.AddItem(tview.NewFlex().SetDirection(tview.FlexRow). AddItem(txt, 1, 0, false). AddItem(feedList(mv, fh), 0, 1, false), 0, 1, false) @@ -74,7 +75,8 @@ func mainViewUI(mv *TutView) *tview.Flex { if mv.tut.Config.General.TimelineName && len(fh.Name) > 0 { txt := NewTextView(mv.tut.Config) txt.SetText(tview.Escape(fh.Name)) - txt.SetTextColor(mv.tut.Config.Style.Subtle) + txt.SetBackgroundColor(mv.tut.Config.Style.TimelineNameBackground) + txt.SetTextColor(mv.tut.Config.Style.TimelineNameText) feeds.AddItem(txt, 1, 0, false) } feeds.AddItem(feedList(mv, fh), 0, 1, false) @@ -85,8 +87,10 @@ func mainViewUI(mv *TutView) *tview.Flex { fc := mv.Timeline.GetFeedContent() content := fc.Main controls := fc.Controls - r := tview.NewFlex().SetDirection(tview.FlexRow). - AddItem(mv.Shared.Top.View, 1, 0, false) + r := tview.NewFlex().SetDirection(tview.FlexRow) + if mv.tut.Config.General.TerminalTitle < 2 { + r.AddItem(mv.Shared.Top.View, 1, 0, false) + } if mv.tut.Config.General.ListPlacement == config.ListPlacementTop { r.AddItem(list, 0, lp, false). AddItem(hl, 1, 0, false). diff --git a/ui/pollview.go b/ui/pollview.go index 3d9ab78..e48687d 100644 --- a/ui/pollview.go +++ b/ui/pollview.go @@ -68,17 +68,20 @@ func pollViewUI(p *PollView) *tview.Flex { p.expiration.SetOptions(durations, p.expirationSelected) p.expiration.SetCurrentOption(4) - return tview.NewFlex().SetDirection(tview.FlexRow). - AddItem(p.shared.Top.View, 1, 0, false). - AddItem(tview.NewFlex().SetDirection(tview.FlexColumn). - AddItem(tview.NewFlex().SetDirection(tview.FlexRow). - AddItem(p.list, 0, 10, false), 0, 2, false). - AddItem(tview.NewBox(), 2, 0, false). - AddItem(tview.NewFlex().SetDirection(tview.FlexRow). - AddItem(p.expiration, 1, 0, false). - AddItem(p.info, 3, 0, false), 0, 1, false), 0, 1, false). + r := tview.NewFlex().SetDirection(tview.FlexRow) + if p.tutView.tut.Config.General.TerminalTitle < 2 { + r.AddItem(p.shared.Top.View, 1, 0, false) + } + r.AddItem(tview.NewFlex().SetDirection(tview.FlexColumn). + AddItem(tview.NewFlex().SetDirection(tview.FlexRow). + AddItem(p.list, 0, 10, false), 0, 2, false). + AddItem(tview.NewBox(), 2, 0, false). + AddItem(tview.NewFlex().SetDirection(tview.FlexRow). + AddItem(p.expiration, 1, 0, false). + AddItem(p.info, 3, 0, false), 0, 1, false), 0, 1, false). AddItem(p.controls, 1, 0, false). AddItem(p.shared.Bottom.View, 2, 0, false) + return r } func (p *PollView) Reset() { diff --git a/ui/preferenceview.go b/ui/preferenceview.go index 76e4ee8..c4bc76c 100644 --- a/ui/preferenceview.go +++ b/ui/preferenceview.go @@ -58,17 +58,20 @@ func preferenceViewUI(p *PreferenceView) *tview.Flex { p.visibility.SetLabel("Default toot visibility: ") p.visibility.SetOptions(visibilitiesPrefStr, p.visibilitySelected) - return tview.NewFlex().SetDirection(tview.FlexRow). - AddItem(p.shared.Top.View, 1, 0, false). - AddItem(tview.NewFlex().SetDirection(tview.FlexColumn). - AddItem(tview.NewFlex().SetDirection(tview.FlexRow). - AddItem(p.displayName, 1, 0, false). - AddItem(p.visibility, 2, 0, false). - AddItem(p.fields, 0, 1, false), 0, 1, false). - AddItem(tview.NewFlex().SetDirection(tview.FlexRow). - AddItem(p.bio, 0, 1, false), 0, 1, false), 0, 1, false). + r := tview.NewFlex().SetDirection(tview.FlexRow) + if p.tutView.tut.Config.General.TerminalTitle < 2 { + r.AddItem(p.shared.Top.View, 1, 0, false) + } + r.AddItem(tview.NewFlex().SetDirection(tview.FlexColumn). + AddItem(tview.NewFlex().SetDirection(tview.FlexRow). + AddItem(p.displayName, 1, 0, false). + AddItem(p.visibility, 2, 0, false). + AddItem(p.fields, 0, 1, false), 0, 1, false). + AddItem(tview.NewFlex().SetDirection(tview.FlexRow). + AddItem(p.bio, 0, 1, false), 0, 1, false), 0, 1, false). AddItem(p.controls, 1, 0, false). AddItem(p.shared.Bottom.View, 2, 0, false) + return r } func (p *PreferenceView) Update() { diff --git a/ui/styled_elements.go b/ui/styled_elements.go index 805e1bd..b583357 100644 --- a/ui/styled_elements.go +++ b/ui/styled_elements.go @@ -12,6 +12,8 @@ func NewModal(cnf *config.Config) *tview.Modal { m.SetBackgroundColor(cnf.Style.Background) m.SetBorderColor(cnf.Style.Background) m.SetBorder(false) + m.SetButtonBackgroundColor(cnf.Style.ButtonColorTwo) + m.SetButtonTextColor(cnf.Style.ButtonColorOne) tview.Styles.BorderColor = cnf.Style.Background return m } @@ -42,12 +44,12 @@ func NewDropDown(cnf *config.Config) *tview.DropDown { dd.SetFieldTextColor(cnf.Style.Text) selected := tcell.Style{}. - Background(cnf.Style.ListSelectedBackground). - Foreground(cnf.Style.ListSelectedText) + Background(cnf.Style.AutocompleteSelectedBackground). + Foreground(cnf.Style.AutocompleteSelectedText) unselected := tcell.Style{}. - Background(cnf.Style.StatusBarViewBackground). - Foreground(cnf.Style.StatusBarViewText) - dd.SetListStyles(selected, unselected) + Background(cnf.Style.AutocompleteBackground). + Foreground(cnf.Style.AutocompleteText) + dd.SetListStyles(unselected, selected) return dd } @@ -57,15 +59,15 @@ func NewInputField(cnf *config.Config) *tview.InputField { i.SetFieldBackgroundColor(cnf.Style.Background) selected := tcell.Style{}. - Background(cnf.Style.ListSelectedBackground). - Foreground(cnf.Style.ListSelectedText) + Background(cnf.Style.AutocompleteSelectedBackground). + Foreground(cnf.Style.AutocompleteSelectedText) unselected := tcell.Style{}. - Background(cnf.Style.StatusBarViewBackground). - Foreground(cnf.Style.StatusBarViewText) + Background(cnf.Style.AutocompleteBackground). + Foreground(cnf.Style.AutocompleteText) i.SetAutocompleteStyles( - cnf.Style.Background, - selected, unselected) + cnf.Style.AutocompleteBackground, + unselected, selected) return i } diff --git a/ui/top.go b/ui/top.go index 82b262c..4aeb6cc 100644 --- a/ui/top.go +++ b/ui/top.go @@ -4,6 +4,7 @@ import ( "fmt" "net/url" + "github.com/RasmusLindroth/tut/util" "github.com/rivo/tview" ) @@ -32,15 +33,22 @@ func (t *Top) SetText(s string) { us = fmt.Sprintf("%s@%s", us, u.Host) } if s == "" { - t.View.SetText(fmt.Sprintf("tut - %s", us)) + t.setText(fmt.Sprintf("tut - %s", us)) } else { - t.View.SetText(fmt.Sprintf("tut - %s - %s", s, us)) + t.setText(fmt.Sprintf("tut - %s - %s", s, us)) } } else { if s == "" { - t.View.SetText("tut") + t.setText("tut") } else { - t.View.SetText(fmt.Sprintf("tut - %s", s)) + t.setText(fmt.Sprintf("tut - %s", s)) } } } + +func (t *Top) setText(s string) { + t.View.SetText(s) + if t.TutView.tut.Config.General.TerminalTitle > 0 { + util.SetTerminalTitle(s) + } +} diff --git a/ui/voteview.go b/ui/voteview.go index 522bfbb..55a51e8 100644 --- a/ui/voteview.go +++ b/ui/voteview.go @@ -38,12 +38,15 @@ func voteViewUI(v *VoteView) *tview.Flex { items = append(items, config.ColorFromKey(v.tutView.tut.Config, v.tutView.tut.Config.Input.VoteSelect, true)) v.controls.SetText(strings.Join(items, " ")) - return tview.NewFlex().SetDirection(tview.FlexRow). - AddItem(v.shared.Top.View, 1, 0, false). - AddItem(v.textTop, 3, 0, false). + r := tview.NewFlex().SetDirection(tview.FlexRow) + if v.tutView.tut.Config.General.TerminalTitle < 2 { + r.AddItem(v.shared.Top.View, 1, 0, false) + } + r.AddItem(v.textTop, 3, 0, false). AddItem(v.list, 0, 10, false). AddItem(v.controls, 1, 0, false). AddItem(v.shared.Bottom.View, 2, 0, false) + return r } func (v *VoteView) SetPoll(poll *mastodon.Poll) { diff --git a/util/util.go b/util/util.go index 027b58c..64c30a9 100644 --- a/util/util.go +++ b/util/util.go @@ -172,3 +172,7 @@ func StatusOrReblog(s *mastodon.Status) *mastodon.Status { } return s } + +func SetTerminalTitle(s string) { + fmt.Printf("\033]0;%s\a", s) +}