mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-18 08:43:57 +00:00
26 lines
618 B
TypeScript
26 lines
618 B
TypeScript
import { themesSublevel } from "@main/level";
|
|
import { registerEvent } from "../register-event";
|
|
import { WindowManager } from "@main/services";
|
|
|
|
const toggleCustomTheme = async (
|
|
_event: Electron.IpcMainInvokeEvent,
|
|
themeId: string,
|
|
isActive: boolean
|
|
) => {
|
|
const theme = await themesSublevel.get(themeId);
|
|
|
|
if (!theme) {
|
|
throw new Error("Theme not found");
|
|
}
|
|
|
|
await themesSublevel.put(themeId, {
|
|
...theme,
|
|
isActive,
|
|
updatedAt: new Date(),
|
|
});
|
|
|
|
WindowManager.notificationWindow?.webContents.send("on-custom-theme-updated");
|
|
};
|
|
|
|
registerEvent("toggleCustomTheme", toggleCustomTheme);
|