
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
keyboard-layout
Advanced tools
[
] (https://ci.appveyor.com/project/Atom/keyboard-layout)
Read and observe the current keyboard layout.
To get the current keyboard layout, call getCurrentKeyboardLayout
. It returns
the string identifier of the current layout based on the value returned by the
operating system.
const KeyboardLayout = require('keyboard-layout')
KeyboardLayout.getCurrentKeyboardLayout() // => "com.apple.keylayout.Dvorak"
If you want to watch for layout changes, use onDidChangeCurrentKeyboardLayout
or observeCurrentKeyboardLayout
. They work the same, except
observeCurrentKeyboardLayout
invokes the given callback immediately with the
current layout value and then again next time it changes, whereas
onDidChangeCurrentKeyboardLayout
only invokes the callback on the next
change.
const KeyboardLayout = require('keyboard-layout')
subscription = KeyboardLayout.observeCurrentKeyboardLayout((layout) => console.log(layout))
subscription.dispose() // to unsubscribe later
To return characters for various modifier states based on a DOM 3
KeyboardEvent.code
value and the current system keyboard layout, use
getCurrentKeymap()
:
const KeyboardLayout = require('keyboard-layout')
KeyboardLayout.getCurrentKeymap()['KeyS']
/*
On a US layout, this returns:
{
unmodified: 's',
withShift: 'S',
withAltGraph: 'ß',
withShiftAltGraph: 'Í'
}
*/
FAQs
Read and observe the current keyboard layout on OS X.
The npm package keyboard-layout receives a total of 371 weekly downloads. As such, keyboard-layout popularity was classified as not popular.
We found that keyboard-layout demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 open source maintainers 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.