Skip to content

Commit

Permalink
Small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
KartoffelChipss committed Jul 23, 2024
1 parent 0504f83 commit 528dab7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
6 changes: 3 additions & 3 deletions public/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ function setSetting(setting, value, fun) {
}

function updateSettings() {
document.getElementById("settings-theme").innerHTML = "";

const getThemes = window.api.invoke("getThemeList").then(({ defaultThemes, customThemes }) => {
document.getElementById("settings-theme").innerHTML = "";

for (const theme of defaultThemes) {
let option = document.createElement("option");
option.text = theme.themeName;
Expand All @@ -30,8 +30,8 @@ function updateSettings() {
}
});

document.getElementById("settings-bgimage").innerHTML = "<option value=''>None</option>";
const getBGImages = window.api.invoke("getBackgroundImages").then((images) => {
document.getElementById("settings-bgimage").innerHTML = "<option value=''>None</option>";
for (const image of images) {
let option = document.createElement("option");
option.text = image.fileName;
Expand Down
1 change: 0 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {app, BrowserWindow, nativeImage, protocol} from "electron";
import logger from "electron-log/main";
import {closeWindow, createWindow, getAllWindows,openMainWindow} from "./windowManager";
import fs from "fs";
import showOpenFileDialog from "./dialog/openFile";
import {updateMenu} from "./menus/appMenu";
import {addRecentFile, getStore} from "./store";
Expand Down
2 changes: 2 additions & 0 deletions src/windowManager/mainWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export function closeMainWindow() {
}

export function openMainWindow() {
if (BrowserWindow.getAllWindows().find(isMainWindow)) return;

const width = 700;
const height = 400;

Expand Down
11 changes: 9 additions & 2 deletions src/windowManager/settingsWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,15 @@ export function closeSettingsWindow() {
}

export function openSettingsWindow() {
const width = 1050;
const height = 750;
for (const window of BrowserWindow.getAllWindows()) {
if (isSettingsWindow(window)) {
window.focus();
return;
}
}

const width = 950;
const height = 650;

const settingsWindow = new BrowserWindow({
minWidth: width,
Expand Down

0 comments on commit 528dab7

Please sign in to comment.