@@ -8,6 +8,7 @@ use crate::{platform, window};
88const DEFUALT_HOTKEY_A : & str = "CmdOrCtrl+Shift+A" ;
99const DEFUALT_HOTKEY_S : & str = "CmdOrCtrl+Shift+S" ;
1010const DEFUALT_HOTKEY_W : & str = "CmdOrCtrl+Shift+W" ;
11+ const DEFUALT_HOTKEY_E : & str = "CmdOrCtrl+Shift+E" ;
1112
1213pub fn register_global_shortcut ( app : & tauri:: App ) -> anyhow:: Result < ( ) > {
1314 info ! ( "Registering global shortcuts" ) ;
@@ -22,6 +23,8 @@ pub fn register_global_shortcut(app: &tauri::App) -> anyhow::Result<()> {
2223 let shift_ctrl_s_shortcut = Shortcut :: from_str ( DEFUALT_HOTKEY_S ) ?;
2324 // capture_window: ctrl + shift + W
2425 let shift_ctrl_w_shortcut = Shortcut :: from_str ( DEFUALT_HOTKEY_W ) ?;
26+ // exit: ctrl + shift + E
27+ let shift_ctrl_e_shortcut = Shortcut :: from_str ( DEFUALT_HOTKEY_E ) ?;
2528
2629 if !shortcuts. is_registered ( shift_ctrl_a_shortcut) {
2730 app. global_shortcut ( ) . register ( shift_ctrl_a_shortcut) ?;
@@ -35,6 +38,10 @@ pub fn register_global_shortcut(app: &tauri::App) -> anyhow::Result<()> {
3538 app. global_shortcut ( ) . register ( shift_ctrl_w_shortcut) ?;
3639 }
3740
41+ if !shortcuts. is_registered ( shift_ctrl_e_shortcut) {
42+ app. global_shortcut ( ) . register ( shift_ctrl_e_shortcut) ?;
43+ }
44+
3845 Ok ( ( ) )
3946}
4047
@@ -96,6 +103,15 @@ pub fn tauri_plugin_global_shortcut() -> TauriPlugin<tauri::Wry> {
96103 info ! ( "Capture Window Released!" ) ;
97104 }
98105 }
106+ } else if shortcut. id == Shortcut :: from_str ( DEFUALT_HOTKEY_E ) . unwrap ( ) . id {
107+ match event. state ( ) {
108+ ShortcutState :: Pressed => {
109+ window:: show_main_window ( app) ;
110+ }
111+ ShortcutState :: Released => {
112+ info ! ( "Show Main Window Released!" ) ;
113+ }
114+ }
99115 }
100116 } )
101117 . build ( )
0 commit comments