mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2024-11-16 11:42:21 +08:00
chore: unified hotkey registration
This commit is contained in:
parent
b8cb48aead
commit
fc5c959a55
|
@ -158,6 +158,7 @@ pub fn run() {
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
{
|
{
|
||||||
log_err!(hotkey::Hotkey::global().register("Control+Q", "quit"));
|
log_err!(hotkey::Hotkey::global().register("Control+Q", "quit"));
|
||||||
|
log_err!(hotkey::Hotkey::global().register("Escape", "quit"));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
tauri::WindowEvent::Focused(false) => {
|
tauri::WindowEvent::Focused(false) => {
|
||||||
|
@ -169,6 +170,7 @@ pub fn run() {
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
{
|
{
|
||||||
log_err!(hotkey::Hotkey::global().unregister("Control+Q"));
|
log_err!(hotkey::Hotkey::global().unregister("Control+Q"));
|
||||||
|
log_err!(hotkey::Hotkey::global().unregister("Escape"));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import "dayjs/locale/zh-cn";
|
||||||
import { getPortableFlag } from "@/services/cmds";
|
import { getPortableFlag } from "@/services/cmds";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { TransitionGroup, CSSTransition } from "react-transition-group";
|
import { TransitionGroup, CSSTransition } from "react-transition-group";
|
||||||
|
|
||||||
const appWindow = getCurrentWebviewWindow();
|
const appWindow = getCurrentWebviewWindow();
|
||||||
export let portableFlag = false;
|
export let portableFlag = false;
|
||||||
|
|
||||||
|
@ -48,13 +49,6 @@ const Layout = () => {
|
||||||
if (!routersEles) return null;
|
if (!routersEles) return null;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
window.addEventListener("keydown", (e) => {
|
|
||||||
// macOS有cmd+w
|
|
||||||
if (e.key === "Escape" && OS !== "macos") {
|
|
||||||
appWindow.close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
listen("verge://refresh-clash-config", async () => {
|
listen("verge://refresh-clash-config", async () => {
|
||||||
// the clash info may be updated
|
// the clash info may be updated
|
||||||
await getAxios(true);
|
await getAxios(true);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user