Merge pull request #161 from rubickCenter/feature/esc

:spakles: close with esc
This commit is contained in:
璃白 2023-03-10 15:56:15 +08:00 committed by GitHub
commit 3846489611
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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();