Skip to content

Commit 5c16f18

Browse files
author
Rayat Rahman
committed
feat: try to register self as http/https url handler on win
1 parent 86d379e commit 5c16f18

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ out
44
.webpack
55
.env
66
.npmrc
7-
.idea
7+
.idea
8+
dist/*

.vscode/settings.json

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"typescript.tsdk": "node_modules/typescript/lib",
3-
"peacock.color": "#234870",
3+
"peacock.color": "#f9e64f",
44
"typescript.preferences.importModuleSpecifier": "relative",
55
"cSpell.words": [
66
"fullscreenable",
@@ -17,5 +17,13 @@
1717
},
1818
"[json]": {
1919
"editor.defaultFormatter": "vscode.json-language-features"
20-
}
20+
},
21+
"workbench.colorCustomizations": {
22+
"sash.hoverBorder": "#fbed80",
23+
"titleBar.activeBackground": "#f9e64f",
24+
"titleBar.activeForeground": "#15202b",
25+
"titleBar.inactiveBackground": "#f9e64f99",
26+
"titleBar.inactiveForeground": "#15202b99"
27+
},
28+
"editor.fontFamily": "'JetBrains Mono', Menlo, Monaco, 'Courier New', monospace"
2129
}

src/main/main.ts

+16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { AnyAction } from '@reduxjs/toolkit'
22
import electron, { app } from 'electron'
3+
import path from 'path'
34
import sleep from 'tings/lib/sleep'
45

56
import { Channel } from '../shared/state/channels'
@@ -25,6 +26,21 @@ if (environment === 'development') {
2526
// Attempt to fix this bug: https://github.com/electron/electron/issues/20944
2627
ifMac(() => app.commandLine.appendArgument('--enable-features=Metal'))
2728
ifWindows(() => app.disableHardwareAcceleration())
29+
ifWindows(() => {
30+
if (process.defaultApp) {
31+
if (process.argv.length >= 2) {
32+
app.setAsDefaultProtocolClient('http', process.execPath, [
33+
path.resolve(process.argv[1]),
34+
])
35+
app.setAsDefaultProtocolClient('https', process.execPath, [
36+
path.resolve(process.argv[1]),
37+
])
38+
}
39+
} else {
40+
app.setAsDefaultProtocolClient('http')
41+
app.setAsDefaultProtocolClient('https')
42+
}
43+
})
2844

2945
app.on('ready', () => dispatch(readiedApp()))
3046

0 commit comments

Comments
 (0)