Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
electron-localshortcut
Advanced tools
register/unregister a keyboard shortcut locally to a BrowserWindow instance, without using a Menu
A module to register/unregister a keyboard shortcut locally to a BrowserWindow instance, without using a Menu.
npm install --save electron-localshortcut
const electronLocalshortcut = require('electron-localshortcut');
const BrowserWindow = require('browser-window');
const win = new BrowserWindow();
win.loadUrl('https://github.com');
win.show();
electronLocalshortcut.register(win, 'Ctrl+A', () => {
console.log('You pressed ctrl & A');
});
electronLocalshortcut.register(win, 'Ctrl+B', () => {
console.log('You pressed ctrl & B');
});
console.log(
electronLocalshortcut.isRegistered(win, 'Ctrl+A')
); // true
electronLocalshortcut.unregister(win, 'Ctrl+A');
electronLocalshortcut.unregisterAll(win);
The electron-localshortcut
module has following methods:
register(window, accelerator, callback)
window
BrowserWindow instanceaccelerator
Acceleratorcallback
FunctionRegisters a shortcut of accelerator
on the window
BrowserWindow instance. The callback
is called when the registered shortcut is pressed by the user, only if window
is focused.
isRegistered(window, accelerator)
window
BrowserWindow instanceaccelerator
AcceleratorReturns true
or false
depending on whether the shortcut accelerator
is
registered on window
.
unregister(window, accelerator)
window
BrowserWindow instanceaccelerator
AcceleratorUnregisters the shortcut of accelerator
registered on the BrowserWindow instance.
unregisterAll(window)
window
BrowserWindow instanceUnregisters all of the shortcuts registered on the BrowserWindow instance.
The MIT License (MIT)
Copyright (c) 2015 Andrea Parodi
FAQs
register/unregister a keyboard shortcut locally to a BrowserWindow instance, without using a Menu
The npm package electron-localshortcut receives a total of 18,669 weekly downloads. As such, electron-localshortcut popularity was classified as popular.
We found that electron-localshortcut demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.