Add shortcut to open new terminal window

This commit is contained in:
2Shirt 2025-01-24 18:56:53 -08:00
parent b8403d6f52
commit 5c0c47cc0f
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
3 changed files with 11 additions and 6 deletions

View file

@ -100,6 +100,7 @@
"<Up>": "KeyUp", "<Up>": "KeyUp",
"<Down>": "KeyDown", "<Down>": "KeyDown",
"<q>": "Quit", "<q>": "Quit",
"<t>": "OpenTerminal",
"<Ctrl-d>": "Quit", "<Ctrl-d>": "Quit",
"<Ctrl-c>": "Quit", "<Ctrl-c>": "Quit",
"<Ctrl-z>": "Suspend" "<Ctrl-z>": "Suspend"

View file

@ -20,7 +20,7 @@ use crate::{components::popup::Type, line::DVLine, state::Mode, system::disk::Di
#[derive(Debug, Clone, PartialEq, Eq, Display, Serialize, Deserialize)] #[derive(Debug, Clone, PartialEq, Eq, Display, Serialize, Deserialize)]
pub enum Action { pub enum Action {
// App // App (Clone)
Highlight(usize), Highlight(usize),
InstallDriver, InstallDriver,
Process, Process,
@ -35,6 +35,8 @@ pub enum Action {
// 1: For a single choice // 1: For a single choice
// 2: For two selections (obviously) // 2: For two selections (obviously)
UpdateRight(Vec<Vec<DVLine>>, usize, Vec<Vec<DVLine>>), // (labels, start_index, items) - items before start are always shown UpdateRight(Vec<Vec<DVLine>>, usize, Vec<Vec<DVLine>>), // (labels, start_index, items) - items before start are always shown
// App (PEMenu)
OpenTerminal,
// Screens // Screens
DismissPopup, DismissPopup,
DisplayPopup(Type, String), DisplayPopup(Type, String),

View file

@ -190,6 +190,8 @@ impl App {
match action { match action {
Action::Tick => { Action::Tick => {
self.last_tick_key_events.drain(..); self.last_tick_key_events.drain(..);
// Check background task(s)
self.tasks.poll()?;
} }
Action::Quit => self.should_quit = true, Action::Quit => self.should_quit = true,
Action::Suspend => self.should_suspend = true, Action::Suspend => self.should_suspend = true,
@ -241,11 +243,11 @@ impl App {
self.action_tx.send(build_right_items(self))?; self.action_tx.send(build_right_items(self))?;
self.action_tx.send(Action::Select(None, None))?; self.action_tx.send(Action::Select(None, None))?;
} }
Action::UpdateFooter(_) Action::OpenTerminal => {
| Action::UpdateLeft(_, _, _, _) self.tasks.add(Task::Command(
| Action::UpdateRight(_, _, _) PathBuf::from("cmd.exe"),
| Action::Highlight(_) => { vec![String::from("-new_console:n")],
info!("Processing Action: {:?}", action); ));
} }
_ => {} _ => {}
} }