add system light/dark mode override

This commit is contained in:
vapormusic 2022-09-10 00:36:23 +07:00
parent 684b34ea8c
commit 0a51a3a7f0
3 changed files with 28 additions and 1 deletions

View file

@ -1,5 +1,5 @@
import { join } from "path";
import { app, BrowserWindow as bw, ipcMain, ShareMenu, shell, screen, dialog } from "electron";
import { app, BrowserWindow as bw, ipcMain, ShareMenu, shell, screen, dialog, nativeTheme } from "electron";
import * as windowStateKeeper from "electron-window-state";
import * as express from "express";
import * as getPort from "get-port";
@ -441,6 +441,8 @@ export class BrowserWindow {
this.options.hasShadow = true;
break;
}
nativeTheme.themeSource = utils.getStoreValue("visual.overrideDisplayTheme")
// Start the webserver for the browser window to load
// LocalFiles.DB.init()
@ -1138,6 +1140,11 @@ export class BrowserWindow {
BrowserWindow.win.setBounds({ x, y });
});
// Override light, dark
ipcMain.on("changeDisplayTheme", (event, theme) => {
nativeTheme.themeSource = theme
});
//Fullscreen
ipcMain.on("setFullScreen", (_event, flag) => {
BrowserWindow.win.setFullScreen(flag);