Skip to content

Commit 74b9876

Browse files
authored
Load jbrowse config passed as CLI arg to desktop and create file association for .jbrowse files on desktop (#5142)
1 parent 991a348 commit 74b9876

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

products/jbrowse-desktop/electron/electron.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,15 @@ async function createWindow() {
208208
})
209209
})
210210

211-
await mainWindow.loadURL(
212-
app.isPackaged
213-
? `file://${path.join(app.getAppPath(), 'build', 'index.html')}`
214-
: url.format(devServerUrl),
215-
)
211+
const appUrl = app.isPackaged
212+
? new URL(`file://${path.join(app.getAppPath(), 'build', 'index.html')}`)
213+
: devServerUrl
214+
const lastArg = process.argv.at(-1)
215+
if (lastArg?.endsWith(".jbrowse")) {
216+
appUrl.searchParams.append('config', lastArg)
217+
}
218+
219+
await mainWindow.loadURL(url.format(appUrl))
216220

217221
mainWindow.webContents.setWindowOpenHandler(details => {
218222
// unsure how to handle

products/jbrowse-desktop/package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,16 @@
114114
"appId": "org.jbrowse2.app",
115115
"productName": "JBrowse 2",
116116
"copyright": "Copyright © 2019",
117+
"fileAssociations": [
118+
{
119+
"ext": "jbrowse",
120+
"name": "JBrowse",
121+
"role": "Editor"
122+
}
123+
],
124+
"nsis": {
125+
"perMachine": true
126+
},
117127
"win": {
118128
"sign": "./sign.js",
119129
"signingHashAlgorithms": [

0 commit comments

Comments
 (0)