fix: windows can't start

This commit is contained in:
lencx
2022-12-28 03:07:17 +08:00
parent bcd350584e
commit 631dee95a7
5 changed files with 156 additions and 79 deletions

View File

@@ -1,4 +1,5 @@
use crate::{app::window, conf::ChatConfJson, utils};
use log::info;
use tauri::{utils::config::WindowUrl, window::WindowBuilder, App, GlobalShortcutManager, Manager};
pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>> {
@@ -11,12 +12,15 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>
window::tray_window(&handle);
});
info!("stepup");
{
info!("global_shortcut_start");
let handle = app.app_handle();
let mut shortcut = app.global_shortcut_manager();
let is_mini_key = shortcut.is_registered("CmdOrCtrl+Shift+O");
if !is_mini_key.unwrap() {
if is_mini_key.is_ok() {
shortcut
.register("CmdOrCtrl+Shift+O", move || {
if let Some(w) = handle.get_window("core") {
@@ -30,6 +34,7 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>
})
.unwrap();
};
info!("global_shortcut_end");
}
if chat_conf.hide_dock_icon {