@@ -10,16 +10,8 @@ const notificationManager = new NotificationManager(() => windowManager.getMainW
1010app . on ( "ready" , async ( ) => {
1111 // Initialize app manager (loads settings)
1212 await appManager . initialize ( ) ;
13- // Create main window
14- const mainWindow = windowManager . createMainWindow ( ) ;
15- // Start activity monitoring
16- await appManager . startActivityMonitoring ( ) ;
17- // Setup global shortcuts
18- appManager . setupGlobalShortcuts ( ( ) => {
19- windowManager . toggleDockVisibility ( ) ;
20- } ) ;
21-
22- // Setup IPC handlers
13+
14+ // Setup IPC handlers BEFORE creating the window to avoid timing issues
2315 const activityService = appManager . getActivityMonitoringService ( ) ;
2416 const chatService = activityService . getChatService ( ) ;
2517 const settingsService = appManager . getSettingsService ( ) ;
@@ -38,6 +30,15 @@ app.on("ready", async () => {
3830 ( ) => notificationManager . showDailyPlanNotification ( )
3931 ) ;
4032
33+ // Create main window AFTER handlers are set up
34+ const mainWindow = windowManager . createMainWindow ( ) ;
35+ // Start activity monitoring
36+ await appManager . startActivityMonitoring ( ) ;
37+ // Setup global shortcuts
38+ appManager . setupGlobalShortcuts ( ( ) => {
39+ windowManager . toggleDockVisibility ( ) ;
40+ } ) ;
41+
4142 // Schedule startup notification (30 seconds after app starts)
4243 notificationManager . scheduleStartupNotification ( 30000 ) ;
4344} ) ;
0 commit comments