Skip to content

Commit 12f573c

Browse files
committed
fix: icon issues, spacing, window sizing
1 parent deeb23b commit 12f573c

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed

forge.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1+
const path = require("path");
2+
13
module.exports = {
24
packagerConfig: {
35
extraResource: [
46
"./resources/server.properties",
57
"./resources/fabric-installer.jar",
8+
"./img/icons/icon_main.png",
69
],
10+
icon: "./img/icons/icon_main",
711
},
812
makers: [
913
{
1014
name: "@electron-forge/maker-squirrel",
1115
config: {
1216
name: "multiserver",
1317
setupIcon: "./img/icons/icon_setup.ico",
14-
iconUrl: `file://${__dirname}/img/icons/icon_main.ico`,
1518
},
1619
},
1720
{

img/icons/icon_main.icns

43.2 KB
Binary file not shown.

src/index.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { runInstance } from "#lib/instances/runInstance";
1111
import { getAvatar } from "#lib/avatar";
1212
import * as settings from "#lib/settings";
1313
import type { InstanceEditOptions } from "#types";
14+
import { resourcesPath } from "#lib/constants";
1415

1516
// declarations for webpack magic constants for built react code
1617
declare const MAIN_WINDOW_WEBPACK_ENTRY: string;
@@ -39,6 +40,10 @@ const createWindow = () => {
3940
webPreferences: {
4041
preload: MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY,
4142
},
43+
icon:
44+
process.platform === "linux"
45+
? `${process.resourcesPath}/icon_main.png`
46+
: undefined,
4247
});
4348

4449
if (app.isPackaged) mainWindow.removeMenu();
@@ -74,11 +79,15 @@ app.on("activate", () => {
7479

7580
ipcMain.on("newInstanceWindow", () => {
7681
const newInstanceWindow = new BrowserWindow({
77-
height: 500,
82+
height: 550,
7883
width: 400,
7984
webPreferences: {
8085
preload: NEW_INSTANCE_WINDOW_PRELOAD_WEBPACK_ENTRY,
8186
},
87+
icon:
88+
process.platform === "linux"
89+
? `${process.resourcesPath}/icon_main.png`
90+
: undefined,
8291
});
8392

8493
if (app.isPackaged) newInstanceWindow.removeMenu();
@@ -93,6 +102,10 @@ ipcMain.on("editInstanceWindow", async (e, name: string) => {
93102
webPreferences: {
94103
preload: EDIT_INSTANCE_WINDOW_PRELOAD_WEBPACK_ENTRY,
95104
},
105+
icon:
106+
process.platform === "linux"
107+
? `${process.resourcesPath}/icon_main.png`
108+
: undefined,
96109
});
97110

98111
if (app.isPackaged) editWindow.removeMenu();
@@ -136,6 +149,10 @@ ipcMain.on("runInstance", (e, name: string) => {
136149
webPreferences: {
137150
preload: RUN_WINDOW_PRELOAD_WEBPACK_ENTRY,
138151
},
152+
icon:
153+
process.platform === "linux"
154+
? `${process.resourcesPath}/icon_main.png`
155+
: undefined,
139156
});
140157

141158
if (app.isPackaged) runWindow.removeMenu();
@@ -183,6 +200,10 @@ ipcMain.on("settingsWindow", () => {
183200
webPreferences: {
184201
preload: SETTINGS_WINDOW_PRELOAD_WEBPACK_ENTRY,
185202
},
203+
icon:
204+
process.platform === "linux"
205+
? `${process.resourcesPath}/icon_main.png`
206+
: undefined,
186207
});
187208

188209
if (app.isPackaged) settingsWindow.removeMenu();

src/windows/NewInstanceWindow.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const NewInstanceWindow = () => {
8282
<h2 className="font-2xl font-bold mb-2">New Instance</h2>
8383
<form
8484
onSubmit={handleFormSubmit}
85-
className="flex container flex-col gap-3"
85+
className="flex container flex-col gap-4"
8686
>
8787
<TextField
8888
name="name"
@@ -92,11 +92,13 @@ const NewInstanceWindow = () => {
9292
value={name}
9393
onChange={(e) => onNameChange(e.target.value)}
9494
/>
95-
{savePath && (
95+
{savePath ? (
9696
<span>
9797
Will be saved as{" "}
9898
<span className="font-mono">{savePath}</span>
9999
</span>
100+
) : (
101+
<div className="h-6"></div> // empty space to cover text location
100102
)}
101103

102104
<div className="flex flex-row justify-start space-x-2">

0 commit comments

Comments
 (0)