-
Notifications
You must be signed in to change notification settings - Fork 57.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
快捷键:呼出窗口并激活输入光标
- Loading branch information
Showing
10 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,29 @@ | ||
// Prevents additional console window on Windows in release, DO NOT REMOVE!! | ||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] | ||
use tauri::{GlobalShortcutManager, Manager}; | ||
|
||
#[tauri::command] | ||
fn update_shortcut(shortcut: String, handle: tauri::AppHandle) { | ||
handle | ||
.global_shortcut_manager() | ||
.unregister_all() | ||
.unwrap(); | ||
|
||
let window = handle.get_window("main").unwrap(); | ||
handle | ||
.global_shortcut_manager() | ||
.register(&shortcut, move || { | ||
window.show().unwrap(); | ||
window.set_focus().unwrap(); | ||
window.emit("activate_input_field", {}).unwrap(); | ||
}) | ||
.unwrap(); | ||
} | ||
|
||
fn main() { | ||
tauri::Builder::default() | ||
.plugin(tauri_plugin_window_state::Builder::default().build()) | ||
.invoke_handler(tauri::generate_handler![update_shortcut]) | ||
.run(tauri::generate_context!()) | ||
.expect("error while running tauri application"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters