From 40d5b20c7d5fd6dd6b32a07f40eafb37d16b4cfd Mon Sep 17 00:00:00 2001 From: Alexandre Pasmantier <47638216+alexpasmantier@users.noreply.github.com> Date: Tue, 19 Nov 2024 00:07:53 +0100 Subject: [PATCH] feat(ui): make the top UI help bar toggleable (#41) --- .config/config.toml | 6 ++++++ crates/television/action.rs | 6 +++--- crates/television/television.rs | 3 +++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.config/config.toml b/.config/config.toml index 02a3b80..9036aad 100644 --- a/.config/config.toml +++ b/.config/config.toml @@ -56,6 +56,8 @@ copy_entry_to_clipboard = "ctrl-y" toggle_remote_control = "ctrl-r" # Toggle the send to channel mode toggle_send_to_channel = "ctrl-s" +# Toggle the help bar +toggle_help = "ctrl-g" # Remote control mode @@ -70,6 +72,8 @@ select_prev_entry = "up" select_entry = "enter" # Toggle the remote control mode toggle_remote_control = "ctrl-r" +# Toggle the help bar +toggle_help = "ctrl-g" # Send to channel mode @@ -84,3 +88,5 @@ select_prev_entry = "up" select_entry = "enter" # Toggle the send to channel mode toggle_send_to_channel = "ctrl-s" +# Toggle the help bar +toggle_help = "ctrl-g" diff --git a/crates/television/action.rs b/crates/television/action.rs index 34e3082..f09725a 100644 --- a/crates/television/action.rs +++ b/crates/television/action.rs @@ -87,9 +87,9 @@ pub enum Action { /// Quit the application. #[serde(alias = "quit")] Quit, - /// Toggle the help screen. - #[serde(skip)] - Help, + /// Toggle the help bar. + #[serde(alias = "toggle_help")] + ToggleHelp, /// Signal an error with the given message. #[serde(skip)] Error(String), diff --git a/crates/television/television.rs b/crates/television/television.rs index 646aa92..2894b99 100644 --- a/crates/television/television.rs +++ b/crates/television/television.rs @@ -360,6 +360,9 @@ impl Television { self.mode = Mode::Channel; } }, + Action::ToggleHelp => { + self.config.ui.show_help_bar = !self.config.ui.show_help_bar; + } _ => {} } Ok(None)