mirror of
https://github.com/rubickCenter/rubick
synced 2025-07-18 22:05:05 +08:00
✨ 支持 Escape 回到主界面
This commit is contained in:
parent
7bebcf4d54
commit
905838235c
@ -21,6 +21,15 @@ dbInstance.init();
|
|||||||
const API: any = {
|
const API: any = {
|
||||||
currentPlugin: null,
|
currentPlugin: null,
|
||||||
DBKEY: "RUBICK_DB_DEFAULT",
|
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) {
|
openPlugin({ plugin }, window) {
|
||||||
if (API.currentPlugin && API.currentPlugin.name === plugin.name) return;
|
if (API.currentPlugin && API.currentPlugin.name === plugin.name) return;
|
||||||
window.setSize(window.getSize()[0], 60);
|
window.setSize(window.getSize()[0], 60);
|
||||||
@ -33,6 +42,9 @@ const API: any = {
|
|||||||
})})`
|
})})`
|
||||||
);
|
);
|
||||||
window.show();
|
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) {
|
removePlugin(e, window) {
|
||||||
API.currentPlugin = null;
|
API.currentPlugin = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user