Skip to content

Instantly share code, notes, and snippets.

@shimarin
Created January 26, 2020 04:21
Show Gist options
  • Save shimarin/6bd73a9b0321cb4877b60062acd5320d to your computer and use it in GitHub Desktop.
Save shimarin/6bd73a9b0321cb4877b60062acd5320d to your computer and use it in GitHub Desktop.
#!/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