From a0e3063702aea2b6730b0a1c3bfc1b8fb948acb2 Mon Sep 17 00:00:00 2001 From: raylu Date: Thu, 24 Jul 2025 15:08:03 -0700 Subject: [PATCH] feat(config): border styles and padding are now configurable (#642) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 📺 PR Description this allows changing (or removing) the border styles tv 0.12.3: image this PR with ```toml [ui.input_bar] border_type = 'none' [ui.results_panel] border_type = 'none' [ui.preview_panel] border_type = 'plain' ``` image see #638 ## Checklist - [ ] my commits **and PR title** follow the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) format - [x] if this is a new feature, I have added tests to consolidate the feature and prevent regressions - [ ] if this is a bug fix, I have added a test that reproduces the bug (if applicable) - [x] I have added a reasonable amount of documentation to the code where appropriate --------- Co-authored-by: alexandre pasmantier --- .config/config.toml | 16 ++- television/channels/prototypes.rs | 69 ++++++------ television/cli/args.rs | 62 ++++++++++- television/cli/mod.rs | 64 ++++++++++- television/config/mod.rs | 129 +++++++++++++++++++--- television/config/themes.rs | 6 +- television/config/ui.rs | 145 ++++++++++++++++++++++--- television/draw.rs | 12 +-- television/main.rs | 174 ++++++++++++++++++++++++++---- television/screen/input.rs | 34 +++--- television/screen/layout.rs | 22 +++- television/screen/preview.rs | 61 ++++++----- television/screen/results.rs | 19 ++-- television/television.rs | 10 +- 14 files changed, 668 insertions(+), 155 deletions(-) diff --git a/.config/config.toml b/.config/config.toml index 57cfc93..725caed 100644 --- a/.config/config.toml +++ b/.config/config.toml @@ -54,10 +54,6 @@ use_nerd_font_icons = false # └───────────────────────────────────────┘ ui_scale = 100 -# Where to place the input bar in the UI (top or bottom) -input_bar_position = "top" -# The input prompt string (defaults to ">" if not specified) -input_prompt = ">" # What orientation should tv be (landscape or portrait) orientation = "landscape" # The theme to use for the UI @@ -100,6 +96,14 @@ remote_control = { enabled = true, visible = false } # Feature-specific configurations # Each feature can have its own configuration section +[ui.input_bar] +# Where to place the input bar in the UI (top or bottom) +position = "top" +# The input prompt string (defaults to ">" if not specified) +prompt = ">" +# header = "{}" +border_type = "rounded" # https://docs.rs/ratatui/latest/ratatui/widgets/block/enum.BorderType.html#variants + [ui.status_bar] # Status bar separators (bubble): #separator_open = "" @@ -108,12 +112,16 @@ remote_control = { enabled = true, visible = false } separator_open = "" separator_close = "" +[ui.results_panel] +border_type = "rounded" + [ui.preview_panel] # Preview panel size (percentage of screen width/height) size = 50 #header = "{}" #footer = "" scrollbar = true +border_type = "rounded" [ui.remote_control] # Whether to show channel descriptions in remote control mode diff --git a/television/channels/prototypes.rs b/television/channels/prototypes.rs index 55f7ad4..b05100f 100644 --- a/television/channels/prototypes.rs +++ b/television/channels/prototypes.rs @@ -1,9 +1,10 @@ use crate::cli::parse_source_entry_delimiter; +use crate::config::ui::InputBarConfig; use crate::{ config::{KeyBindings, ui}, event::Key, features::Features, - screen::layout::{InputPosition, Orientation}, + screen::layout::Orientation, }; use anyhow::Result; use rustc_hash::FxHashMap; @@ -387,16 +388,14 @@ pub struct UiSpec { // `layout` is clearer for the user but collides with the overall `Layout` type. #[serde(rename = "layout", alias = "orientation", default)] pub orientation: Option, - #[serde(default)] - pub input_bar_position: Option, - #[serde(default)] - pub input_header: Option