File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -116,7 +116,8 @@ class StreamSnapApp {
116116 } catch ( e ) { }
117117 }
118118
119- await this . windowManager . createMainWindow ( )
119+ const isHiddenLaunch = app . getLoginItemSettings ( ) . wasOpenedAsHidden || process . argv . includes ( '--hidden' )
120+ await this . windowManager . createMainWindow ( isHiddenLaunch )
120121 this . isInitialized = true
121122
122123 try {
Original file line number Diff line number Diff line change @@ -174,7 +174,9 @@ class WindowHandlers {
174174 try {
175175 electronApp . setLoginItemSettings ( {
176176 openAtLogin : enabled ,
177- path : electronApp . getPath ( 'exe' )
177+ path : electronApp . getPath ( 'exe' ) ,
178+ openAsHidden : true ,
179+ args : [ '--hidden' ]
178180 } )
179181 return { success : true }
180182 } catch ( error ) {
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ class WindowManager {
9191 }
9292 }
9393
94- async createMainWindow ( ) {
94+ async createMainWindow ( startMinimized = false ) {
9595 try {
9696 this . windows . main = new BrowserWindow ( {
9797 ...WINDOW_CONFIG . main ,
@@ -109,18 +109,14 @@ class WindowManager {
109109
110110 await this . windows . main . loadFile ( 'src/windows/main.html' )
111111
112- this . windows . main . webContents . once ( 'dom-ready' , ( ) => {
113- this . windows . main . show ( )
114- } )
115-
116112 this . windows . main . once ( 'ready-to-show' , ( ) => {
117- if ( ! this . windows . main . isVisible ( ) ) {
113+ if ( startMinimized ) {
114+ this . windows . main . minimize ( )
115+ } else {
118116 this . windows . main . show ( )
119117 }
120118 } )
121119
122- this . windows . main . show ( )
123-
124120 this . windows . main . on ( 'closed' , ( ) => {
125121 this . windows . main = null
126122 } )
You can’t perform that action at this time.
0 commit comments