diff --git a/config/config.json5 b/config/config.json5 index 1a27554..15471b4 100644 --- a/config/config.json5 +++ b/config/config.json5 @@ -146,6 +146,8 @@ "": "KeyUp", "": "KeyDown", "": "Quit", + "": "Restart", + "

": "Shutdown", "": "OpenTerminal", "": "Quit", "": "Quit", diff --git a/core/src/action.rs b/core/src/action.rs index b578031..b2928a2 100644 --- a/core/src/action.rs +++ b/core/src/action.rs @@ -39,6 +39,8 @@ pub enum Action { UpdateRight(Vec>, usize, Vec>), // (labels, start_index, items) - items before start are always shown // App (PE-Menu) OpenTerminal, + Restart, + Shutdown, // Screens DismissPopup, DisplayPopup(Type, String), diff --git a/pe_menu/src/app.rs b/pe_menu/src/app.rs index 9ec8c58..4922332 100644 --- a/pe_menu/src/app.rs +++ b/pe_menu/src/app.rs @@ -249,6 +249,35 @@ impl App { vec![String::from("-new_console:n")], )); } + Action::Restart => { + self.action_tx.send(Action::DisplayPopup( + popup::Type::Info, + String::from("Restarting..."), + ))?; + self.tasks.add(Task::Command( + PathBuf::from("X:/Windows/System32/sync64.exe"), + vec![String::from("-r")], + )); + self.tasks.add(Task::Command( + PathBuf::from("X:/Windows/System32/wpeutil.exe"), + vec![String::from("reboot")], + )); + } + Action::Shutdown => { + // NOTE: Using 'Powering off' to match the key pressed + self.action_tx.send(Action::DisplayPopup( + popup::Type::Info, + String::from("Powering off..."), + ))?; + self.tasks.add(Task::Command( + PathBuf::from("X:/Windows/System32/sync64.exe"), + vec![String::from("-r")], + )); + self.tasks.add(Task::Command( + PathBuf::from("X:/Windows/System32/wpeutil.exe"), + vec![String::from("shutdown")], + )); + } _ => {} } for component in &mut self.components {