File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
resources/js/electron-plugin/src Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ const { autoUpdater } = electronUpdater;
22
22
class NativePHP {
23
23
processes = [ ] ;
24
24
schedulerInterval = undefined ;
25
+ mainWindow = null ;
25
26
26
27
public bootstrap (
27
28
app : CrossProcessExports . App ,
@@ -88,6 +89,17 @@ class NativePHP {
88
89
89
90
event . preventDefault ( ) ;
90
91
} ) ;
92
+
93
+ // Handle deep linking for Windows
94
+ if ( process . platform === 'win32' ) {
95
+ app . on ( 'second-instance' , ( event , commandLine , workingDirectory ) => {
96
+ if ( this . mainWindow ) {
97
+ if ( this . mainWindow . isMinimized ( ) ) this . mainWindow . restore ( ) ;
98
+ this . mainWindow . focus ( ) ;
99
+ }
100
+ this . handleDeepLink ( commandLine . pop ( ) ) ;
101
+ } ) ;
102
+ }
91
103
}
92
104
93
105
private async bootstrapApp ( app : Electron . CrossProcessExports . App ) {
@@ -161,6 +173,15 @@ class NativePHP {
161
173
} else {
162
174
app . setAsDefaultProtocolClient ( deepLinkProtocol ) ;
163
175
}
176
+
177
+
178
+ if ( process . platform === 'win32' ) {
179
+ const gotTheLock = app . requestSingleInstanceLock ( ) ;
180
+ if ( ! gotTheLock ) {
181
+ app . quit ( ) ;
182
+ return ;
183
+ }
184
+ }
164
185
}
165
186
}
166
187
You can’t perform that action at this time.
0 commit comments