Created
January 26, 2020 04:21
-
-
Save shimarin/6bd73a9b0321cb4877b60062acd5320d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/electron | |
module.paths.push("/usr/lib64/node_modules"); | |
const path = require("path"); | |
const {app, globalShortcut, BrowserWindow} = require('electron'); | |
const contextMenu = require('electron-context-menu'); | |
var mainWindow = null; | |
contextMenu(); | |
const url = process.argv[2]; | |
// Quit when all windows are closed. | |
app.on('window-all-closed', function() { | |
app.quit(); | |
}); | |
app.on('ready', function() { | |
mainWindow = new BrowserWindow({ | |
width: 800, | |
height: 600, | |
autoHideMenuBar: true, | |
useContentSize: true, | |
webPreferences: { | |
nodeIntegration: false | |
} | |
}); | |
globalShortcut.register('CommandOrControl+W', () => { | |
mainWindow.close(); | |
}) | |
if (url) { | |
mainWindow.loadURL(url); | |
} | |
mainWindow.setMenu(null); | |
mainWindow.focus(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment