Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* eslint-env node */
const {BrowserWindow, app} = require('electron');
let mainWindow = null;
app.on('window-all-closed', function onWindowAllClosed() {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('ready', function onReady() {
mainWindow = new BrowserWindow({
width: 800,
height: 600
});
delete mainWindow.module;
if (process.env.EMBER_ENV === 'test') {
mainWindow.loadURL('file://' + __dirname + '/index.html');
} else {
mainWindow.loadURL('file://' + __dirname + '/dist/index.html');
}
mainWindow.on('closed', function onClosed() {
mainWindow = null;
});
if (focusedWindow) {
focusedWindow.minimize();
}
}
}
]
}
]);
ipcMain.on('contextmenu-click', function() {
rightClickMenu.popup();
});
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
app.on('ready', function() {
// Application Menu
var appMenu = Menu.buildFromTemplate([
{
label: 'OpenBazaar',
submenu: [
{
label: 'Quit OpenBazaar',
accelerator: 'CmdOrCtrl+Q',
click: function() {
app.quit();
}
}
]
},
{
const {
app: App,
BrowserWindow,
Menu
} = require('electron');
// please set the environmental variable KKT_SV_NAME as the name of your server.
const Pug = require('electron-pug')({ pretty: true }, {
version: PKG.version,
serverName: SETTINGS['server-name'] || process.env['KKT_SV_NAME']
});
const Runner = require("./runner.js");
let mainWindow;
App.on('ready', main);
App.on('window-all-closed', () => {
if(process.platform != 'darwin'){
App.quit();
}
});
App.on('activate', () => {
if(mainWindow === null){
main();
}
});
Runner.send = (...argv) => {
mainWindow.webContents.send.apply(mainWindow.webContents, argv);
};
function main(){
Menu.setApplicationMenu(Menu.buildFromTemplate(Runner.MAIN_MENU));
let mainWindow: BrowserWindow | null
let tray: Tray | null
const winURL = process.env.NODE_ENV === 'development' ? `http://localhost:9080` : `file://${__dirname}/index.html`
// MAS build is not allowed requestSingleInstanceLock.
// ref: https://github.com/h3poteto/whalebird-desktop/issues/1030
// ref: https://github.com/electron/electron-osx-sign/issues/137#issuecomment-307626305
if (process.platform !== 'darwin') {
// Enforces single instance for linux and windows.
const gotTheLock = app.requestSingleInstanceLock()
if (!gotTheLock) {
app.quit()
} else {
app.on('second-instance', () => {
// Someone tried to run a second instance, we should focus our window.
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore()
if (!mainWindow!.isVisible()) {
mainWindow!.show()
mainWindow!.setSkipTaskbar(false)
}
mainWindow.focus()
}
})
}
}
const appId = pkg.build.appId
const splashURL =
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)
// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
})
const {app, globalShortcut, BrowserWindow} = require('electron');
let mainWindow;
// Quit when all windows are closed.
app.on('window-all-closed', function() {
app.quit();
});
// This method will be called when Electron has done everything
// initialization and ready for creating browser windows.
app.on('ready', function() {
// Create the browser window.
mainWindow = new BrowserWindow({title: 'CS:GO Music Player', icon: 'logo.ico', width: 400, height: 700, maxWidth: 400, minWidth: 400, frame: false});
const next = globalShortcut.register('ALT+N', () => {
mainWindow.webContents.send('queueNext');
})
const startStop = globalShortcut.register('ALT+M', () => {
mainWindow.webContents.send('togglePlayer');
})
// and load the index.html of the app.
mainWindow.loadURL('file://' + __dirname + '/index.html');
loginWindow.close();
webview.loadURL(getURL());
}
});
} else if (newURL.startsWith(getURL()) && loginWindow) {
loginWindow.close();
}
});
webview.addEventListener('new-window', ({ url }) => {
shell.openExternal(url);
});
// Ensure focus propagates when the application is focused
const webviewFocusHandler = new FocusHandler(webview);
app.on('browser-window-focus', webviewFocusHandler);
};
});
app.on('activate', () => {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (sluiApp === undefined) {
createWindow();
}
});
// Make sure Substrate stops when UI stops
app.on('before-quit', killSubstrate);
app.on('will-quit', killSubstrate);
app.on('quit', () => {
killSubstrate();
});
),
});
} else {
callback({ cancel: false });
}
});
});
}
app.on('activate', () => {
if (rendererWindow) {
rendererWindow.show();
}
});
app.on('will-quit', event => {
if (
process.platform === 'win32' &&
autoUpdateDownloaded &&
!appState.autoUpdateAccepted &&
!showingAutoUpdateCloseAlert
) {
// We're on Win and have an update downloaded, but the user declined it (or closed
// the app without accepting it). Now the user is closing the app, so the new update
// will install. On Mac this is silent, but on Windows they get a confusing permission
// escalation dialog, so we show Windows users a warning dialog first.
showingAutoUpdateCloseAlert = true;
dialog.showMessageBox(
{
type: 'info',
title: 'LBRY Will Upgrade',
const {app, Tray, Menu, BrowserWindow} = require('electron');
const path = require('path');
const brightness = require('./app')
const iconPath = path.join(__dirname, 'logo.png');
const open = require('open')
let appIcon = null;
let win = null;
const activeWin = require('active-win')
app.on('ready', function (){
win = new BrowserWindow({show: false});
appIcon = new Tray(iconPath);
var contextMenu = Menu.buildFromTemplate([
{
label: 'Links',
submenu: [
{
label: 'Website / GitHub',
click: () => {
open('https://github.com/bencevans/lumenaire')
}
},
{
label: 'Discussion / Issues',
click: () => {
open('https://github.com/bencevans/lumenaire/issues')