1
- import { clipboard , shell } from "electron/common" ;
1
+ import { clipboard } from "electron/common" ;
2
2
import {
3
3
BrowserWindow ,
4
4
type IpcMainEvent ,
@@ -157,8 +157,6 @@ function createMainWindow(): BrowserWindow {
157
157
}
158
158
159
159
await app . whenReady ( ) ;
160
- // Register custom protocol handler
161
- app . setAsDefaultProtocolClient ( "zulip" ) ;
162
160
163
161
if ( process . env . GDK_BACKEND !== GDK_BACKEND ) {
164
162
console . warn (
@@ -176,20 +174,14 @@ function createMainWindow(): BrowserWindow {
176
174
177
175
remoteMain . initialize ( ) ;
178
176
179
- app . on ( "second-instance" , ( event , commandLine ) => {
177
+ app . on ( "second-instance" , ( ) => {
180
178
if ( mainWindow ) {
181
179
if ( mainWindow . isMinimized ( ) ) {
182
180
mainWindow . restore ( ) ;
183
181
}
184
182
185
183
mainWindow . show ( ) ;
186
184
}
187
- // Handle deep link when opened from protocol
188
-
189
- const url = commandLine . find ( ( argument ) => argument . startsWith ( "zulip://" ) ) ;
190
- if ( url ) {
191
- mainWindow . webContents . send ( "open-url" , url ) ;
192
- }
193
185
} ) ;
194
186
195
187
ipcMain . on (
@@ -204,24 +196,6 @@ function createMainWindow(): BrowserWindow {
204
196
app . on ( "activate" , ( ) => {
205
197
mainWindow . show ( ) ;
206
198
} ) ;
207
- // Handle deep linking when app is already running (macOS)
208
- app . on ( "open-url" , async ( event , url ) => {
209
- event . preventDefault ( ) ;
210
-
211
- const response = await dialog . showMessageBox ( {
212
- type : "question" ,
213
- buttons : [ "Open in App" , "Open in Browser" ] ,
214
- defaultId : 0 ,
215
- message : `Do you want to open this link in the desktop app or browser?` ,
216
- detail : url ,
217
- } ) ;
218
-
219
- if ( response . response === 0 ) {
220
- mainWindow . webContents . send ( "open-url" , url ) ;
221
- } else {
222
- await shell . openExternal ( url ) ; // Open in browser
223
- }
224
- } ) ;
225
199
226
200
app . on ( "web-contents-created" , ( _event , contents : WebContents ) => {
227
201
contents . setWindowOpenHandler ( ( details ) => {
0 commit comments