How to use the electron-util.is function in electron-util

To help you get started, we’ve selected a few electron-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github coountdown / coountdown / main / index.js View on Github external
// Constants
let onlineStatusWindow
let twitterLoginWindow
let tray
let isQuit = false
let loggedIn = false
let alreadyGetUser = false
const appLaunchTime = moment()

setupSentry(app)
store.setupNoti()
app.setName(config.APP_NAME)

// Hide dock icon (In production mode, it's setup on package.json. [key: LSUIElement])
if (isDev && electronUtil.is.macos) {
  app.dock.hide()
}

if (firstRun()) {
  app.setLoginItemSettings({ openAtLogin: true })
}

const gotTheLock = app.requestSingleInstanceLock()

if (!gotTheLock) {
  app.quit()
}

// Process Cycle
app.on('ready', async () => {
  // Checking internet connection
github therehq / there-desktop / main / index.js View on Github external
}
setLoggedInStatus()

// Set the application's name
app.setName('There')

// Make There start automatically on login
if (!isDev && firstRun()) {
  app.setLoginItemSettings({ openAtLogin: true })
}

// Hide dock icon before the app starts
// This is only required for development because
// we're setting a property on the bundled app
// in production, which prevents the icon from flickering
if (isDev && electronUtils.is.macos) {
  app.dock.hide()
}

// Makes sure where inheriting the correct path
// Within the bundled app, the path would otherwise be different
fixPath()

app.on('window-all-closed', () => {
  if (!electronUtils.is.macos) {
    app.quit()
  }
})

const contextMenu = (tray, windows) => {
  if (process.env.CONNECTION === 'offline') {
    return outerMenu(app, tray, windows)
github therehq / there-desktop / main / index.js View on Github external
electronUtils.enforceMacOSAppLocation()

  // Set menu to enable copy & paste
  if (!isDev) {
    Menu.setApplicationMenu(Menu.buildFromTemplate(appMenu(app)))
  }

  // Setup enhanced devtools
  devtools.setupElectronDebug()
  devtools.installExtensions()

  mixpanel.track(app, 'Open App')

  // Create Tray
  try {
    const iconName = electronUtils.is.windows ? 'iconWhite' : 'iconTemplate'
    tray = new Tray(resolvePath(`./main/static/tray/${iconName}.png`))
    tray.setToolTip('There PM')
  } catch (err) {
    Raven.captureException(err)
    return
  }

  // Migrate data to current version
  migrate(app)

  // Init menubar
  const menuBar = trayWindow(tray)

  // Create windows
  const windows = {
    main: menuBar.window,