How to use the electron-util.is.linux 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 timche / gmail-desktop / src / menu.ts View on Github external
// If the style changes requires a restart, don't add or remove the class
    // name from the DOM
    if (restartDialogText) {
      showRestartDialog(checked, restartDialogText)
    } else {
      setCustomStyle(key, checked)
    }

    if (setMenuBarVisibility) {
      setAppMenuBarVisibility(true)
    }
  }
})

if (is.linux || is.windows) {
  appearanceMenuItems.unshift({
    key: ConfigKey.AutoHideMenuBar,
    label: 'Hide Menu bar',
    setMenuBarVisibility: true
  })
}

const applicationMenu: MenuItemConstructorOptions[] = [
  {
    label: APP_NAME,
    submenu: [
      {
        label: `About ${APP_NAME}`,
        role: 'about'
      },
      {
github ooni / probe-desktop / main / utils / paths.js View on Github external
const getResourcesDirectory = () => {
  // XXX only macos development is currently supported
  if (is.development) {
    const rsrcPath = path.join(__dirname, '..', '..')
    debug('💣 development mode', rsrcPath)
    return rsrcPath
  }

  const appPath = (electron.app || electron.remote.app).getPath('exe')

  if (is.macos) {
    return path.join(appPath, '../../Resources')
  }
  if (is.linux) {
    return path.join(path.dirname(appPath), './resources')
  }
  if (is.windows) {
    return path.join(path.dirname(appPath), './resources')
  }

  // Other platforms we should just use relative paths and hope
  // for the best
  return './resources'
}
github sindresorhus / caprine / source / index.ts View on Github external
const lastWindowState = config.get('lastWindowState');
	const isDarkMode = config.get('darkMode');

	// Messenger or Work Chat
	const mainURL = config.get('useWorkChat') ?
		'https://work.facebook.com/chat' :
		'https://www.messenger.com/login/';

	const win = new BrowserWindow({
		title: app.name,
		show: false,
		x: lastWindowState.x,
		y: lastWindowState.y,
		width: lastWindowState.width,
		height: lastWindowState.height,
		icon: is.linux ? caprineIconPath : undefined,
		minWidth: 400,
		minHeight: 200,
		alwaysOnTop: config.get('alwaysOnTop'),
		titleBarStyle: 'hiddenInset',
		autoHideMenuBar: config.get('autoHideMenuBar'),
		darkTheme: isDarkMode, // GTK+3
		webPreferences: {
			preload: path.join(__dirname, 'browser.js'),
			contextIsolation: true,
			plugins: true
		}
	});

	setUserLocale();
	initRequestsFiltering();
github LulumiProject / lulumi-browser / src / shared / store / mainStore.ts View on Github external
import { getters } from './getters';
import modules from './modules';

import { writeFile } from 'fs';
import promisify from '../../main/lib/promisify';
import urlUtil from '../../renderer/lib/url-util';

Vue.use(Vuex);

/* tslint:disable:max-line-length */
/* tslint:disable:no-console */
/* tslint:disable:object-shorthand-properties-first */

const isDarwin: boolean = is.macos;
const isWindows: boolean = is.windows;
const isLinux: boolean = is.linux;

const globalObject = global as Lulumi.API.GlobalObject;

const windows: Electron.BrowserWindow[] = [];

const broadcastMutations = (store) => {
  store.subscribe((mutation) => {
    Object.keys(windows).forEach((key) => {
      const id = parseInt(key, 10);
      if (typeof windows[id] !== 'number') {
        windows[id].webContents.send('vuex-apply-mutation', mutation);
      } else {
        delete windows[id];
      }
    });
  });
github sindresorhus / caprine / source / index.ts View on Github external
*/
		defaultActions.copyLink({
			transform: stripTrackingFromUrl
		});

		return [];
	}
});

app.setAppUserModelId('com.sindresorhus.caprine');

if (!config.get('hardwareAcceleration')) {
	app.disableHardwareAcceleration();
}

if (!is.development && !is.linux) {
	(async () => {
		log.transports.file.level = 'info';
		autoUpdater.logger = log;

		const FOUR_HOURS = 1000 * 60 * 60 * 4;
		setInterval(async () => {
			await autoUpdater.checkForUpdates();
		}, FOUR_HOURS);

		await autoUpdater.checkForUpdates();
	})();
}

let mainWindow: BrowserWindow;
let isQuitting = false;
let previousMessageCount = 0;
github timche / gmail-desktop / src / app.ts View on Github external
nodeIntegration: false,
      nativeWindowOpen: true,
      preload: path.join(__dirname, 'preload')
    },
    show: !shouldStartMinimized
  })

  if (lastWindowState.fullscreen && !mainWindow.isFullScreen()) {
    mainWindow.setFullScreen(lastWindowState.fullscreen)
  }

  if (lastWindowState.maximized && !mainWindow.isMaximized()) {
    mainWindow.maximize()
  }

  if (is.linux || is.windows) {
    setAppMenuBarVisibility()
  }

  mainWindow.loadURL('https://mail.google.com')

  mainWindow.webContents.on('dom-ready', () => {
    addCustomCSS(mainWindow)
    initCustomStyles()
  })

  mainWindow.on('close', e => {
    if (!isQuitting) {
      e.preventDefault()
      mainWindow.blur()
      mainWindow.hide()
    }
github sindresorhus / caprine / source / menu.ts View on Github external
}
			}
		},
		{
			label: 'Flash Window on Message',
			type: 'checkbox',
			visible: !is.macos,
			checked: config.get('flashWindowOnMessage'),
			click(menuItem) {
				config.set('flashWindowOnMessage', menuItem.checked);
			}
		},
		{
			label: 'Show Tray Icon',
			type: 'checkbox',
			enabled: is.linux || is.windows,
			checked: config.get('showTrayIcon'),
			click() {
				config.set('showTrayIcon', !config.get('showTrayIcon'));
				sendAction('toggle-tray-icon');
			}
		},
		{
			label: 'Launch Minimized',
			type: 'checkbox',
			visible: !is.macos,
			checked: config.get('launchMinimized'),
			click() {
				config.set('launchMinimized', !config.get('launchMinimized'));
				sendAction('toggle-tray-icon');
			}
		},