How to use electron-localshortcut - 10 common examples

To help you get started, we’ve selected a few electron-localshortcut 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 tma02 / spotispy / lib / main.js View on Github external
// 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;
  });

  screen = electron.screen;
  displays = screen.getAllDisplays();
  console.log('enumerated', displays.length, 'displays.');
  mainWindow.setFullScreen(true);

  // register two local shortcuts
  electronLocalshortcut.register('CommandOrControl+Shift+Left', function() {
    currentDisplay--;
    if (currentDisplay < 0) {
      currentDisplay = displays.length - 1;
    }
    currentDisplay%=(displays.length);
    console.log('switching to display', currentDisplay + 1, 'out of', displays.length);
    mainWindow.setFullScreen(false);
    setTimeout(function() {
      mainWindow.setBounds(displays[currentDisplay].bounds);
      mainWindow.setFullScreen(true);
    }, 100);
  });

  electronLocalshortcut.register('CommandOrControl+Shift+Right', function() {
    currentDisplay++;
    currentDisplay%=(displays.length);
github tma02 / spotispy / lib / main.js View on Github external
// 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;
  });

  screen = electron.screen;
  displays = screen.getAllDisplays();
  console.log('enumerated', displays.length, 'displays.');
  mainWindow.setFullScreen(true);

  // register two local shortcuts
  electronLocalshortcut.register('CommandOrControl+Shift+Left', function() {
    currentDisplay--;
    if (currentDisplay < 0) {
      currentDisplay = displays.length - 1;
    }
    currentDisplay%=(displays.length);
    console.log('switching to display', currentDisplay + 1, 'out of', displays.length);
    mainWindow.setFullScreen(false);
    setTimeout(function() {
      mainWindow.setBounds(displays[currentDisplay].bounds);
      mainWindow.setFullScreen(true);
    }, 100);
  });

  electronLocalshortcut.register('CommandOrControl+Shift+Right', function() {
    currentDisplay++;
    currentDisplay%=(displays.length);
github davidferguson / pibakery / main.js View on Github external
autoHideMenuBar: true,
    title: 'PiBakery'
    /* icon: 'app/img/icon.png' */
  })

  mainWindow.loadURL(path.join('file://', __dirname, '/app/index.html'))

  mainWindow.on('closed', function () {
    electron.app.quit()
  })

  electronLocalshortcut.register(mainWindow, 'CommandOrControl+Shift+I', function () {
    mainWindow.toggleDevTools()
  })

  electronLocalshortcut.register(mainWindow, 'CommandOrControl+V', function () {
    mainWindow.webContents.send('paste', electron.clipboard.readText())
  })

  electronLocalshortcut.register(mainWindow, 'CommandOrControl+Shift+Plus', function () {
    mainWindow.webContents.send('testBlock')
  })
  
  createMenu()
}
github rafaelleru / torrent_player_old / src / main.js View on Github external
// Open the DevTools.
    //jmainWindow.webContents.openDevTools()

    // 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
    })

    //Registramos los eventos justo al cargar la aplicacion

    shortcut.register('Space', function(){
	mainWindow.send('PlayPause', isPaused);
    });
}
github zulip / zulip-desktop / app / main / index.js View on Github external
function registerLocalShortcuts(page) {
	// Somehow, reload action cannot be overwritten by the menu item
	electronLocalshortcut.register(mainWindow, 'CommandOrControl+R', () => {
		page.send('reload-viewer');
	});

	// Also adding these shortcuts because some users might want to use it instead of CMD/Left-Right
	electronLocalshortcut.register(mainWindow, 'CommandOrControl+[', () => {
		page.send('back');
	});

	electronLocalshortcut.register(mainWindow, 'CommandOrControl+]', () => {
		page.send('forward');
	});
}
github zulip / zulip-desktop / app / main / index.js View on Github external
function registerLocalShortcuts(page) {
	// Somehow, reload action cannot be overwritten by the menu item
	electronLocalshortcut.register(mainWindow, 'CommandOrControl+R', () => {
		page.send('reload-viewer');
	});

	// Also adding these shortcuts because some users might want to use it instead of CMD/Left-Right
	electronLocalshortcut.register(mainWindow, 'CommandOrControl+[', () => {
		page.send('back');
	});

	electronLocalshortcut.register(mainWindow, 'CommandOrControl+]', () => {
		page.send('forward');
	});
}
github yasumichi / seapig / js / seapig.js View on Github external
function registLocalShortcuts(win) {
  localShortcut.register(win, 'CommandOrControl+N', createNewFile);
  localShortcut.register(win, 'CommandOrControl+O', callOpenFile);
  localShortcut.register(win, 'CommandOrControl+P', callPrintToPDF);
  localShortcut.register(win, 'CommandOrControl+S', callSaveFile);
}
github yasumichi / seapig / js / seapig.js View on Github external
function registLocalShortcuts(win) {
  localShortcut.register(win, 'CommandOrControl+N', createNewFile);
  localShortcut.register(win, 'CommandOrControl+O', callOpenFile);
  localShortcut.register(win, 'CommandOrControl+P', callPrintToPDF);
  localShortcut.register(win, 'CommandOrControl+S', callSaveFile);
}
github yasumichi / seapig / js / seapig.js View on Github external
function registLocalShortcuts(win) {
  localShortcut.register(win, 'CommandOrControl+N', createNewFile);
  localShortcut.register(win, 'CommandOrControl+O', callOpenFile);
  localShortcut.register(win, 'CommandOrControl+P', callPrintToPDF);
  localShortcut.register(win, 'CommandOrControl+S', callSaveFile);
}
github Moeditor / Moeditor / app / moe-app.js View on Github external
registerShortcuts() {
        shortcut.register('Ctrl + N', () => {
            MoeditorAction.openNew();
        });

        shortcut.register('Ctrl + O', () => {
            MoeditorAction.open();
        });

        shortcut.register('Ctrl + S', () => {
            MoeditorAction.save();
        });

        shortcut.register('Ctrl + Shift + S', () => {
            MoeditorAction.saveAs();
        });

        shortcut.register('Ctrl + Shift + R', () => {

electron-localshortcut

register/unregister a keyboard shortcut locally to a BrowserWindow instance, without using a Menu

MIT
Latest version published 5 years ago

Package Health Score

53 / 100
Full package analysis

Popular electron-localshortcut functions