diff --git a/tui/src/float.rs b/tui/src/float.rs index 56676f9b5..1f5b56c0a 100644 --- a/tui/src/float.rs +++ b/tui/src/float.rs @@ -56,7 +56,11 @@ impl Float { // Returns true if the floating window is finished. pub fn handle_key_event(&mut self, key: &KeyEvent) -> bool { match key.code { - KeyCode::Enter | KeyCode::Char('p') | KeyCode::Char('d') | KeyCode::Esc + KeyCode::Enter + | KeyCode::Char('p') + | KeyCode::Char('d') + | KeyCode::Char('g') + | KeyCode::Esc if self.content.is_finished() => { true diff --git a/tui/src/floating_text.rs b/tui/src/floating_text.rs index 2b8d07bd9..2cd638240 100644 --- a/tui/src/floating_text.rs +++ b/tui/src/floating_text.rs @@ -30,6 +30,7 @@ use zips::zip_result; pub enum FloatingTextMode { Preview, Description, + ActionsGuide, } pub struct FloatingText { @@ -182,6 +183,7 @@ impl FloatingText { match mode { FloatingTextMode::Preview => "Command Preview", FloatingTextMode::Description => "Command Description", + FloatingTextMode::ActionsGuide => "Important Actions Guide", } } @@ -299,7 +301,7 @@ impl FloatContent for FloatingText { Shortcut::new(vec!["k", "Up"], "Scroll up"), Shortcut::new(vec!["h", "Left"], "Scroll left"), Shortcut::new(vec!["l", "Right"], "Scroll right"), - Shortcut::new(vec!["Enter", "p", "d"], "Close window"), + Shortcut::new(vec!["Enter", "p", "d", "g"], "Close window"), ], } } diff --git a/tui/src/hint.rs b/tui/src/hint.rs index 651d144c5..e59eab5a7 100644 --- a/tui/src/hint.rs +++ b/tui/src/hint.rs @@ -144,6 +144,7 @@ pub fn draw_shortcuts(state: &AppState, frame: &mut Frame, area: Rect) { } hints.push(Shortcut::new(vec!["Tab"], "Next tab")); hints.push(Shortcut::new(vec!["Shift-Tab"], "Previous tab")); + hints.push(Shortcut::new(vec!["g"], "Important actions guide")); ShortcutList { scope_name: "Command list", hints, diff --git a/tui/src/state.rs b/tui/src/state.rs index 8699a5a59..2642afbcc 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -22,6 +22,16 @@ use ratatui::{ const MIN_WIDTH: u16 = 77; const MIN_HEIGHT: u16 = 19; const TITLE: &str = concat!("Linux Toolbox - ", env!("BUILD_DATE")); +const ACTIONS_GUIDE: &str = "D - disk modifications (ex. partitioning) (privileged) +FI - flatpak installation +FM - file modification +I - installation (privileged) +SI - full system installation +SS - systemd actions (privileged) +RP - package removal + +P* - privileged * +"; pub struct AppState { /// Selected theme @@ -188,7 +198,7 @@ impl AppState { let list_chunks = Layout::default() .direction(Direction::Horizontal) - .constraints([Constraint::Percentage(60), Constraint::Percentage(40)].as_ref()) + .constraints([Constraint::Percentage(85), Constraint::Percentage(15)].as_ref()) .split(chunks[1]); self.filter.draw_searchbar(frame, chunks[0], &self.theme); @@ -365,6 +375,7 @@ impl AppState { KeyCode::Char('/') => self.enter_search(), KeyCode::Char('t') => self.theme.next(), KeyCode::Char('T') => self.theme.prev(), + KeyCode::Char('g') => self.toggle_task_list_guide(), _ => {} }, Focus::List if key.kind != KeyEventKind::Release => match key.code { @@ -383,6 +394,7 @@ impl AppState { KeyCode::Char('/') => self.enter_search(), KeyCode::Char('t') => self.theme.next(), KeyCode::Char('T') => self.theme.prev(), + KeyCode::Char('g') => self.toggle_task_list_guide(), KeyCode::Char('v') | KeyCode::Char('V') => self.toggle_multi_select(), KeyCode::Char(' ') if self.multi_select => self.toggle_selection(), _ => {} @@ -558,6 +570,14 @@ impl AppState { self.selection.select(Some(0)); self.update_items(); } + + fn toggle_task_list_guide(&mut self) { + self.spawn_float( + FloatingText::new(ACTIONS_GUIDE.to_string(), FloatingTextMode::ActionsGuide), + 80, + 80, + ); + } } #[cfg(feature = "tips")]