mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48:23 +01:00
proof of concept, open window
This commit is contained in:
parent
5a835e927e
commit
c6e29c3314
33
src/emain.ts
33
src/emain.ts
@ -39,11 +39,38 @@ let menu = electron.Menu.buildFromTemplate(menuTemplate);
|
|||||||
electron.Menu.setApplicationMenu(menu);
|
electron.Menu.setApplicationMenu(menu);
|
||||||
|
|
||||||
let MainWindow = null;
|
let MainWindow = null;
|
||||||
|
let RemotesWindow = null;
|
||||||
|
|
||||||
function getMods(input : any) {
|
function getMods(input : any) {
|
||||||
return {meta: input.meta, shift: input.shift, ctrl: input.ctrl, alt: input.alt};
|
return {meta: input.meta, shift: input.shift, ctrl: input.ctrl, alt: input.alt};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cancelNav(event : any, url : any) {
|
||||||
|
console.log("cancel navigation", url);
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
function createRemotesWindow() {
|
||||||
|
if (RemotesWindow != null) {
|
||||||
|
console.log("remotes exists");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log("create remotes window");
|
||||||
|
let win = new electron.BrowserWindow({
|
||||||
|
width: 800,
|
||||||
|
height: 600,
|
||||||
|
webPreferences: {
|
||||||
|
preload: path.join(__dirname, "../src/preload.js"),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
RemotesWindow = win;
|
||||||
|
win.loadFile("../static/remotes.html");
|
||||||
|
win.on("close", () => {
|
||||||
|
RemotesWindow = null;
|
||||||
|
});
|
||||||
|
win.webContents.on("will-navigate", cancelNav);
|
||||||
|
}
|
||||||
|
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
let win = new electron.BrowserWindow({
|
let win = new electron.BrowserWindow({
|
||||||
width: 1800,
|
width: 1800,
|
||||||
@ -73,6 +100,11 @@ function createWindow() {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (input.code == "KeyR" && input.meta && input.alt) {
|
||||||
|
createRemotesWindow();
|
||||||
|
e.preventDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (input.meta && (input.code == "ArrowUp" || input.code == "ArrowDown")) {
|
if (input.meta && (input.code == "ArrowUp" || input.code == "ArrowDown")) {
|
||||||
if (input.code == "ArrowUp") {
|
if (input.code == "ArrowUp") {
|
||||||
win.webContents.send("meta-arrowup");
|
win.webContents.send("meta-arrowup");
|
||||||
@ -97,6 +129,7 @@ function createWindow() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
win.webContents.on("will-navigate", cancelNav);
|
||||||
return win;
|
return win;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
static/remotes.html
Normal file
1
static/remotes.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<h1>Remotes!</h1>
|
Loading…
Reference in New Issue
Block a user