Partial about window implementation
This commit is contained in:
parent
b3c4959c7c
commit
5d1a5e3ecb
3 changed files with 55 additions and 0 deletions
|
|
@ -97,6 +97,11 @@ if (!process.env.PLATFORM) {
|
|||
}
|
||||
|
||||
const customVitePluginBuild: VitePluginBuildConfig[] = [
|
||||
{
|
||||
entry: "about.html",
|
||||
config: "vite.main.config.ts",
|
||||
target: "main",
|
||||
},
|
||||
{
|
||||
entry: "src/main.ts",
|
||||
config: "vite.main.config.ts",
|
||||
|
|
|
|||
42
src/native/about.ts
Normal file
42
src/native/about.ts
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import { join } from "node:path";
|
||||
|
||||
import { BrowserWindow } from "electron";
|
||||
|
||||
import { mainWindow } from "./window";
|
||||
|
||||
// global reference to about window
|
||||
export let aboutWindow: BrowserWindow;
|
||||
|
||||
// Create our about window
|
||||
export function createAboutWindow() {
|
||||
aboutWindow = new BrowserWindow({
|
||||
minWidth: 300,
|
||||
minHeight: 300,
|
||||
width: 1280,
|
||||
height: 720,
|
||||
center: true,
|
||||
backgroundColor: "#191919",
|
||||
frame: true,
|
||||
resizable: false,
|
||||
parent: mainWindow,
|
||||
paintWhenInitiallyHidden: true,
|
||||
webPreferences: {
|
||||
preload: join(__dirname, "preload.js"),
|
||||
contextIsolation: true,
|
||||
nodeIntegration: false,
|
||||
spellcheck: false,
|
||||
devTools: false,
|
||||
},
|
||||
});
|
||||
|
||||
aboutWindow.loadFile("about.html");
|
||||
|
||||
aboutWindow.on("ready-to-show", () => {
|
||||
aboutWindow.show();
|
||||
});
|
||||
|
||||
aboutWindow.on("close", (e) => {
|
||||
e.preventDefault();
|
||||
aboutWindow.hide();
|
||||
});
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@ import {
|
|||
|
||||
import windowIconAsset from "../../avia_assets/icon.png?asset";
|
||||
|
||||
import { aboutWindow, createAboutWindow } from "./about";
|
||||
import { config } from "./config";
|
||||
import { updateTrayMenu } from "./tray";
|
||||
|
||||
|
|
@ -145,6 +146,13 @@ export function createMainWindow() {
|
|||
// reset zoom to default.
|
||||
event.preventDefault();
|
||||
mainWindow.webContents.setZoomLevel(0);
|
||||
} else if (input.key === "F1") {
|
||||
event.preventDefault();
|
||||
if (!aboutWindow) {
|
||||
createAboutWindow();
|
||||
} else {
|
||||
aboutWindow.show();
|
||||
}
|
||||
} else if (
|
||||
input.key === "F5" ||
|
||||
((input.control || input.meta) && input.key.toLowerCase() === "r")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue