mirror of
https://github.com/rubickCenter/rubick
synced 2025-07-16 20:27:29 +08:00
✨ 支持 Escape 回到主界面
This commit is contained in:
parent
7bebcf4d54
commit
905838235c
@ -21,6 +21,15 @@ dbInstance.init();
|
||||
const API: any = {
|
||||
currentPlugin: null,
|
||||
DBKEY: "RUBICK_DB_DEFAULT",
|
||||
__EscapeKeyDown: (event, input, window) => {
|
||||
if (input.type !== "keyDown") return;
|
||||
if (!(input.meta || input.control || input.shift || input.alt)) {
|
||||
if (input.key === "Escape") {
|
||||
API.removePlugin(null, window);
|
||||
}
|
||||
return;
|
||||
}
|
||||
},
|
||||
openPlugin({ plugin }, window) {
|
||||
if (API.currentPlugin && API.currentPlugin.name === plugin.name) return;
|
||||
window.setSize(window.getSize()[0], 60);
|
||||
@ -33,6 +42,9 @@ const API: any = {
|
||||
})})`
|
||||
);
|
||||
window.show();
|
||||
// 按 ESC 退出插件
|
||||
window.webContents.on("before-input-event", (event, input) => API.__EscapeKeyDown(event, input, window));
|
||||
runnerInstance.getView().webContents.on("before-input-event", (event, input) => API.__EscapeKeyDown(event, input, window));
|
||||
},
|
||||
removePlugin(e, window) {
|
||||
API.currentPlugin = null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user