Skip to content

Commit

Permalink
electron dimensions (#107)
Browse files Browse the repository at this point in the history
* overflow fix

* retain electron dimensions
  • Loading branch information
BLCK-B authored Nov 3, 2024
1 parent 1639408 commit d1b7148
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/main/resources/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<link rel="icon" href="./assets/MRTicon-BABpuI07.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MusicReleaseTracker</title>
<script type="module" crossorigin src="./assets/index-D5zbyZ3U.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-CJfouMlu.css">
<script type="module" crossorigin src="./assets/index-BJ6ju_70.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-B2pjO0sV.css">
</head>
<body>
<div id="app"></div>
Expand Down
18 changes: 16 additions & 2 deletions vue/electron-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import path from "path";
import { fileURLToPath } from "url";
import { spawn } from "child_process";
import axios from "axios";
import windowStateKeeper from "electron-window-state";

axios.defaults.baseURL = "http://localhost:57782";

const __filename = fileURLToPath(import.meta.url);
Expand All @@ -15,19 +17,29 @@ let externalEXE;

function createWindow() {
if (process.env.NODE_ENV !== "development") Menu.setApplicationMenu(null);

const mainWindowState = windowStateKeeper({
defaultWidth: 900,
defaultHeight: 650,
});

const win = new BrowserWindow({
icon: path.join(__dirname, "buildResources/MRTicon.ico"),
show: false,
backgroundColor: "#000000",
width: 900,
height: 650,
width: mainWindowState.width,
height: mainWindowState.height,
minHeight: 450,
minWidth: 720,
x: mainWindowState.x,
y: mainWindowState.y,
webPreferences: {
preload: path.join(__dirname, "electron-preload.js"),
},
});

mainWindowState.manage(win);

win.webContents.setWindowOpenHandler(({ url }) => {
shell.openExternal(url);
return { action: "deny" };
Expand Down Expand Up @@ -64,9 +76,11 @@ app.whenReady().then(async () => {
if (process.env.NODE_ENV !== "development") {
externalEXE = spawn("buildResources/MusicReleaseTracker", { detached: true, stdio: "ignore" });
}

await checkBackendReady();

createWindow();

app.on("activate", () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
Expand Down
30 changes: 27 additions & 3 deletions vue/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
},
"dependencies": {
"axios": "^1.7.7",
"electron-window-state": "^5.0.3",
"vue": "^3.5.12",
"vue-router": "^4.4.5",
"vuex": "^4.1.0"
Expand Down

0 comments on commit d1b7148

Please sign in to comment.