:spakles: close with esc

This commit is contained in:
layyback 2023-03-10 15:51:53 +08:00
parent 9f21823792
commit ac1b202f44
2 changed files with 9 additions and 4 deletions

View File

@ -13,7 +13,7 @@ import fs from "fs";
import { LocalDb } from "@/core";
import plist from "plist";
import { DECODE_KEY } from "@/common/constans/main";
import mainInstance from "../index";
const runnerInstance = runner();
const detachInstance = detach();
const dbInstance = new LocalDb(app.getPath("userData"));
@ -44,8 +44,13 @@ class API {
if (input.type !== "keyDown") return;
if (!(input.meta || input.control || input.shift || input.alt)) {
if (input.key === "Escape") {
if (this.currentPlugin) {
this.removePlugin(null, window);
} else {
mainInstance.windowCreator.getWindow().hide();
}
}
return;
}
};

View File

@ -19,7 +19,7 @@ import "../common/utils/localConfig";
import registerySystemPlugin from "./common/registerySystemPlugin";
class App {
private windowCreator: { init: () => void; getWindow: () => BrowserWindow };
public windowCreator: { init: () => void; getWindow: () => BrowserWindow };
private systemPlugins: any;
constructor() {
@ -122,4 +122,4 @@ class App {
}
}
new App();
export default new App();