fix: fixing update of inactive theme

This commit is contained in:
Chubby Granny Chaser
2025-02-16 20:32:18 +00:00
parent 401e61a6ec
commit b999da31d4
7 changed files with 38 additions and 19 deletions

View File

@@ -85,7 +85,6 @@ import "./themes/update-custom-theme";
import "./themes/open-editor-window";
import "./themes/get-custom-theme-by-id";
import "./themes/get-active-custom-theme";
import "./themes/css-injector";
import "./themes/close-editor-window";
import "./themes/toggle-custom-theme";
import { isPortableVersion } from "@main/helpers";

View File

@@ -1,11 +0,0 @@
import { registerEvent } from "../register-event";
import { WindowManager } from "@main/services";
const injectCSS = async (
_event: Electron.IpcMainInvokeEvent,
cssString: string
) => {
WindowManager.mainWindow?.webContents.send("css-injected", cssString);
};
registerEvent("injectCSS", injectCSS);

View File

@@ -1,5 +1,6 @@
import { themesSublevel } from "@main/level";
import { registerEvent } from "../register-event";
import { WindowManager } from "@main/services";
const updateCustomTheme = async (
_event: Electron.IpcMainInvokeEvent,
@@ -17,6 +18,10 @@ const updateCustomTheme = async (
code,
updatedAt: new Date(),
});
if (theme.isActive) {
WindowManager.mainWindow?.webContents.send("css-injected", code);
}
};
registerEvent("updateCustomTheme", updateCustomTheme);