|
6 | 6 | //! - 管理快捷键线程 |
7 | 7 | //! - 管理启动应用程序的进程状态 |
8 | 8 |
|
| 9 | +use crate::file_ops::{execute_process, open_config}; |
9 | 10 | use crate::types::*; |
10 | 11 | use crate::window_handle::{is_process_running, set_window_topmost_by_pid}; |
11 | | -use crate::{file_ops::{execute_process, open_config}, msgbox::error_msgbox}; |
12 | 12 | use std::{ |
13 | 13 | sync::{ |
| 14 | + Arc, Mutex, |
14 | 15 | atomic::{AtomicBool, Ordering}, |
15 | | - mpsc, Arc, Mutex, |
| 16 | + mpsc, |
16 | 17 | }, |
17 | 18 | thread, |
18 | 19 | {path::PathBuf, thread::JoinHandle}, |
19 | 20 | }; |
20 | 21 | use tao::event_loop::EventLoopProxy; |
21 | | -use windows_hotkeys::{singlethreaded::HotkeyManager, HotkeyManagerImpl}; |
| 22 | +use win_msgbox_timeout::error_msgbox; |
| 23 | +use windows_hotkeys::{HotkeyManagerImpl, singlethreaded::HotkeyManager}; |
22 | 24 |
|
23 | 25 | /// 设置全局快捷键并返回事件发送器 |
24 | 26 | /// |
@@ -65,7 +67,12 @@ pub fn set_hotkeys( |
65 | 67 | key_groups.get("screen_capture").unwrap().vkey, |
66 | 68 | &key_groups.get("screen_capture").unwrap().mod_keys, |
67 | 69 | move || { |
68 | | - let args = crate::file_ops::build_capture_args(comp_val, scale_val, &save_path_clone, false); |
| 70 | + let args = crate::file_ops::build_capture_args( |
| 71 | + comp_val, |
| 72 | + scale_val, |
| 73 | + &save_path_clone, |
| 74 | + false, |
| 75 | + ); |
69 | 76 | execute_process(&exe_path_clone, args, gui_clone.clone(), notification, lang); |
70 | 77 | }, |
71 | 78 | ); |
@@ -175,8 +182,19 @@ pub fn set_hotkeys( |
175 | 182 | key_groups.get("screen_capture_long").unwrap().vkey, |
176 | 183 | &key_groups.get("screen_capture_long").unwrap().mod_keys, |
177 | 184 | move || { |
178 | | - let args = crate::file_ops::build_capture_args(comp_val2, scale_val2, &save_path_clone, true); |
179 | | - execute_process(&exe_path_clone, args, gui_clone.clone(), notification2, lang); |
| 185 | + let args = crate::file_ops::build_capture_args( |
| 186 | + comp_val2, |
| 187 | + scale_val2, |
| 188 | + &save_path_clone, |
| 189 | + true, |
| 190 | + ); |
| 191 | + execute_process( |
| 192 | + &exe_path_clone, |
| 193 | + args, |
| 194 | + gui_clone.clone(), |
| 195 | + notification2, |
| 196 | + lang, |
| 197 | + ); |
180 | 198 | }, |
181 | 199 | ); |
182 | 200 | if hotkey_scl.is_err() { |
|
0 commit comments