Last active
September 26, 2017 05:35
-
-
Save adamkirkwood/c439293473cd3d1dc226538435c55584 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint strict: 0 */ | |
'use strict'; | |
const electron = require('electron') | |
const { | |
app, | |
dialog, | |
autoUpdater, | |
protocol, | |
Menu, | |
ipcMain, | |
ipcRenderer, | |
globalShortcut | |
} = electron | |
const menubar = require('menubar') | |
const opts = { | |
dir: __dirname, | |
icon: __dirname + '/src/IconTemplate.png', | |
width: 720, | |
height: 540, | |
index: (__PRODUCTION__ && __ELECTRON__) | |
? `file://${__dirname}/src/dist/index.html` | |
: `http://localhost:${SERVER_PORT}/`, | |
resizable: false, | |
alwaysOnTop: false, | |
showOnAllWorkspaces: true, | |
preloadWindow: true, | |
tooltip: `Sketchpacks ${pkg.version}`, | |
backgroundColor: '#f8f9fa' | |
} | |
const menuBar = menubar(opts) | |
let mainWindow | |
let updater | |
app.on('ready', () => { | |
protocol.registerHttpProtocol('sketchpacks', (request, callback) => { | |
const uri = url.parse(request.url) | |
}, (err) => { | |
if (err) console.error('Failed to register protocol', err) | |
}) | |
}) | |
app.on('open-url', (event, resource) => { | |
event.preventDefault() // Handle event ourselves | |
const uri = url.parse(resource) | |
// ... logic to handle the uri | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"build": { | |
"asar": true, | |
"protocols": { | |
"name": "Sketchpacks", | |
"schemes": [ | |
"sketchpacks" | |
] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment