diff --git a/public/electron.js b/public/electron.js index 902965b..b5beb1a 100644 --- a/public/electron.js +++ b/public/electron.js @@ -24,6 +24,7 @@ protocol.registerSchemesAsPrivileged([ /** * Determine whether the desktop app is on macOS + * - Returns: Boolean of whether platform is Darwin */ function darwin() { return process.platform === "darwin"; @@ -149,17 +150,18 @@ function createWindow() { // Load the main app and open the index page. mainWindow.loadURL("hyperspace://hyperspace/app/"); - + // Watch for a change in macOS's dark mode and reload the window to apply changes - systemPreferences.subscribeNotification('AppleInterfaceThemeChangedNotification', () => { + if (darwin()) { + systemPreferences.subscribeNotification('AppleInterfaceThemeChangedNotification', () => { if (mainWindow != null) { - console.log(`Dark mode: ${systemPreferences.isDarkMode()}`) if (!catalina()) { mainWindow.setVibrancy(systemPreferences.isDarkMode()? "ultra-dark": "light"); } mainWindow.webContents.reload(); } }) + } // Delete the window when closed mainWindow.on('closed', () => {