1- const { app, Tray, Menu, ipcMain, Notification } = require ( 'electron' ) ;
1+ const { app, Tray, Menu, BrowserWindow , ipcMain, Notification } = require ( 'electron' ) ;
22const { PARAMS , VALUE , MicaBrowserWindow, IS_WINDOWS_11 , WIN10 } = require ( 'mica-electron' ) ;
33const path = require ( 'path' ) ;
44
55let mainWindow ;
6+ let themeEditorWindow = null ;
67let tray = null ;
78
89
@@ -74,11 +75,42 @@ app.on('ready', () => {
7475 tray . setContextMenu ( contextMenu ) ;
7576} ) ;
7677
78+ function createThemeEditorWindow ( ) {
79+ if ( themeEditorWindow ) {
80+ themeEditorWindow . focus ( ) ;
81+ return ;
82+ }
83+
84+ themeEditorWindow = new BrowserWindow ( {
85+ width : 800 ,
86+ height : 600 ,
87+ webPreferences : {
88+ contextIsolation : true ,
89+ nodeIntegration : false ,
90+ preload : path . join ( __dirname , 'preload.js' ) ,
91+ } ,
92+ title : "Theme Editor" ,
93+ autoHideMenuBar : true ,
94+ } ) ;
95+
96+ themeEditorWindow . maximize ( ) ;
97+
98+ themeEditorWindow . loadURL ( 'https://vorlie.pages.dev/theme-editor' ) ;
99+
100+ themeEditorWindow . on ( 'closed' , ( ) => {
101+ themeEditorWindow = null ;
102+ } ) ;
103+ }
104+
105+ // IPC listener to open the theme editor
106+ ipcMain . on ( 'open-theme-editor' , ( ) => {
107+ createThemeEditorWindow ( ) ;
108+ } ) ;
109+
77110app . on ( 'window-all-closed' , ( ) => {
78111 if ( process . platform !== 'darwin' ) app . quit ( ) ;
79112} ) ;
80113
81-
82114function showNotification ( title , body ) {
83115 if ( Notification . isSupported ( ) ) {
84116 let iconPath ;
@@ -102,5 +134,4 @@ function showNotification(title, body) {
102134 } else {
103135 console . log ( 'Notifications are not supported on this system.' ) ;
104136 }
105- }
106-
137+ }
0 commit comments