How to use the electron-util.darkMode.isEnabled 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 notable / notable / src / common / settings.ts View on Github external
defaults: {
    cwd: undefined,
    monaco: {
      editorOptions: {
        minimap: {
          enabled: false
        },
        lineNumbers: 'off',
        wordWrap: 'bounded'
      }
    },
    sorting: {
      by: 'title',
      type: 'ascending'
    },
    theme: darkMode.isEnabled ? 'dark' : 'light',
    tutorial: false // Did we import the tutorial yet?
  }
});

/* EXPORT */

export default Settings;
github brandly / Lax / src / js / reducers / settings.js View on Github external
// @flow
import { combineReducers } from 'redux'
import { darkMode } from 'electron-util'
import Persistor from '../modules/Persistor'
import type { Action } from '../flow'

const init = {
  isDark: darkMode.isEnabled,
  quitMessage: 'https://github.com/brandly/Lax'
}

function isDark(state: boolean = init.isDark, action: Action): boolean {
  switch (action.type) {
    case 'TOGGLE_THEME':
      return !state
    default:
      return state
  }
}

function quitMessage(state: string = init.quitMessage, action: Action): string {
  switch (action.type) {
    case 'SET_QUIT_MSG':
      return action.message
github hello-efficiency-inc / raven-reader / src / main / index.js View on Github external
}
})

app.on('before-quit', () => {
  app.isQuiting = true
  globalShortcut.unregisterAll()
  tray.destroy()
})

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') {
    app.quit()
  }
})

if (darkMode.isEnabled) {
  if (mainWindow) {
    mainWindow.webContents.send('Dark mode', {
      darkmode: systemPreferences.isDarkMode()
    })
  }
}

darkMode.onChange(() => {
  if (mainWindow) {
    mainWindow.webContents.send('Dark mode', {
      darkmode: darkMode.isEnabled
    })
  }
})

ipcMain.on('article-selected', (event, status) => {
github zce / electron-boilerplate / src / common / store.ts View on Github external
export const state = new Store({
  name: 'state',
  defaults: {
    lastWindowState: {
      width: 1024,
      height: 768,
      x: undefined as number | undefined,
      y: undefined as number | undefined
    }
  }
})

export const settings = new Store({
  name: 'settings',
  defaults: {
    theme: darkMode.isEnabled ? 'dark' : 'light',
    locale: api.app.getLocale(),
    titleBarStyle: 'custom' as 'custom' | 'native'
  }
})
github npezza93 / archipelago / app / main / windows / search.js View on Github external
toggle(currentPosition) {
    if (searchWindow === null || searchWindow.isDestroyed()) {
      searchWindow = makeWindow('search', {
        width: 300,
        height: 280,
        x: currentPosition[0] - 300,
        y: currentPosition[1],
        backgroundColor: darkMode.isEnabled ? '#393736' : '#F5F5F5'
      })
      searchWindow.title = 'Search'
    } else {
      searchWindow.focus()
    }
  },
  next() {
github npezza93 / archipelago / app / renderer / settings / settings.jsx View on Github external
initialState() {
    return {isDarkMode: darkMode.isEnabled}
  }
github npezza93 / archipelago / app / renderer / traffic-lights.jsx View on Github external
get backgroundColor() {
    let color
    if (this.props.currentProfile) {
      color = this.props.currentProfile.get('tabColor')
    } else if (darkMode.isEnabled) {
      color = '#F5F5F5'
    } else {
      color = '#424242'
    }

    return color
  }
github hello-efficiency-inc / raven-reader / src / main / index.js View on Github external
darkMode.onChange(() => {
  if (mainWindow) {
    mainWindow.webContents.send('Dark mode', {
      darkmode: darkMode.isEnabled
    })
  }
})
github npezza93 / archipelago / app / renderer / search / search.jsx View on Github external
initialState() {
    return {
      isDarkMode: darkMode.isEnabled,
      query: '',
      regex: false,
      caseSensitive: false,
      wholeWord: false
    }
  }
github npezza93 / archipelago / app / main / windows / search.js View on Github external
toggle(currentPosition) {
    if (searchWindow === null || searchWindow.isDestroyed()) {
      searchWindow = makeWindow('search', {
        width: 300,
        height: 280,
        x: currentPosition[0] - 300,
        y: currentPosition[1],
        backgroundColor: darkMode.isEnabled ? '#393736' : '#F5F5F5'
      })
      searchWindow.title = 'Search'
    } else {
      searchWindow.focus()
    }
  },
  next() {