Skip to content

Commit f21dbfe

Browse files
committed
chore: single window handling
1 parent aa24cf1 commit f21dbfe

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/phoenix/shell.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ Phoenix.app = {
299299
if(handlerFn){
300300
singleInstanceCLIHandler = handlerFn;
301301
}
302-
if(Phoenix.isNativeApp){
302+
if(window.__TAURI__){
303303
window.__TAURI__.event.listen("single-instance", ({payload})=> {
304304
handlerFn(payload.args, payload.cwd);
305305
});
@@ -338,6 +338,13 @@ Phoenix.app = {
338338
window.__TAURI__.event.emit('scheme-request-received', {fileURLArray: filesURLList});
339339
});
340340
});
341+
} else if(window.__ELECTRON__){
342+
// Listen for single instance event from main process
343+
window.electronAPI.onSingleInstance((payload) => {
344+
handlerFn(payload.args, payload.cwd);
345+
});
346+
// macOS deep linking (scheme-request-received, get_mac_deep_link_requests) not implemented for Electron yet
347+
// Implement macOS open-with handling when needed. we dont have a electron edge now in mac/windows.
341348
}
342349
},
343350
clipboardReadText: function () {

0 commit comments

Comments
 (0)