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",
"<Down>": "KeyDown",
"<q>": "Quit",
"<t>": "OpenTerminal",
"<Ctrl-d>": "Quit",
"<Ctrl-c>": "Quit",
"<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)]
pub enum Action {
// App
// App (Clone)
Highlight(usize),
InstallDriver,
Process,
@ -35,6 +35,8 @@ pub enum Action {
// 1: For a single choice
// 2: For two selections (obviously)
UpdateRight(Vec<Vec<DVLine>>, usize, Vec<Vec<DVLine>>), // (labels, start_index, items) - items before start are always shown
// App (PEMenu)
OpenTerminal,
// Screens
DismissPopup,
DisplayPopup(Type, String),

View file

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