Skip to content

Commit

Permalink
fix: icon issues, spacing, window sizing
Browse files Browse the repository at this point in the history
  • Loading branch information
ariscript committed Jan 10, 2022
1 parent c2efdb8 commit c1dea02
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
5 changes: 4 additions & 1 deletion forge.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
const path = require("path");

module.exports = {
packagerConfig: {
extraResource: [
"./resources/server.properties",
"./resources/fabric-installer.jar",
"./img/icons/icon_main.png",
],
icon: "./img/icons/icon_main",
},
makers: [
{
name: "@electron-forge/maker-squirrel",
config: {
name: "multiserver",
setupIcon: "./img/icons/icon_setup.ico",
iconUrl: `file://${__dirname}/img/icons/icon_main.ico`,
},
},
{
Expand Down
Binary file added img/icons/icon_main.icns
Binary file not shown.
23 changes: 22 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { runInstance } from "#lib/instances/runInstance";
import { getAvatar } from "#lib/avatar";
import * as settings from "#lib/settings";
import type { InstanceEditOptions } from "#types";
import { resourcesPath } from "#lib/constants";

// declarations for webpack magic constants for built react code
declare const MAIN_WINDOW_WEBPACK_ENTRY: string;
Expand Down Expand Up @@ -39,6 +40,10 @@ const createWindow = () => {
webPreferences: {
preload: MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY,
},
icon:
process.platform === "linux"
? `${process.resourcesPath}/icon_main.png`
: undefined,
});

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

ipcMain.on("newInstanceWindow", () => {
const newInstanceWindow = new BrowserWindow({
height: 500,
height: 550,
width: 400,
webPreferences: {
preload: NEW_INSTANCE_WINDOW_PRELOAD_WEBPACK_ENTRY,
},
icon:
process.platform === "linux"
? `${process.resourcesPath}/icon_main.png`
: undefined,
});

if (app.isPackaged) newInstanceWindow.removeMenu();
Expand All @@ -93,6 +102,10 @@ ipcMain.on("editInstanceWindow", async (e, name: string) => {
webPreferences: {
preload: EDIT_INSTANCE_WINDOW_PRELOAD_WEBPACK_ENTRY,
},
icon:
process.platform === "linux"
? `${process.resourcesPath}/icon_main.png`
: undefined,
});

if (app.isPackaged) editWindow.removeMenu();
Expand Down Expand Up @@ -136,6 +149,10 @@ ipcMain.on("runInstance", (e, name: string) => {
webPreferences: {
preload: RUN_WINDOW_PRELOAD_WEBPACK_ENTRY,
},
icon:
process.platform === "linux"
? `${process.resourcesPath}/icon_main.png`
: undefined,
});

if (app.isPackaged) runWindow.removeMenu();
Expand Down Expand Up @@ -183,6 +200,10 @@ ipcMain.on("settingsWindow", () => {
webPreferences: {
preload: SETTINGS_WINDOW_PRELOAD_WEBPACK_ENTRY,
},
icon:
process.platform === "linux"
? `${process.resourcesPath}/icon_main.png`
: undefined,
});

if (app.isPackaged) settingsWindow.removeMenu();
Expand Down
6 changes: 4 additions & 2 deletions src/windows/NewInstanceWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const NewInstanceWindow = () => {
<h2 className="font-2xl font-bold mb-2">New Instance</h2>
<form
onSubmit={handleFormSubmit}
className="flex container flex-col gap-3"
className="flex container flex-col gap-4"
>
<TextField
name="name"
Expand All @@ -92,11 +92,13 @@ const NewInstanceWindow = () => {
value={name}
onChange={(e) => onNameChange(e.target.value)}
/>
{savePath && (
{savePath ? (
<span>
Will be saved as{" "}
<span className="font-mono">{savePath}</span>
</span>
) : (
<div className="h-6"></div> // empty space to cover text location
)}

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

0 comments on commit c1dea02

Please # to comment.