Name: keyboard-layout-prebuilt
Owner: Secure Scuttlebutt Consortium
Description: Fork of keyboard-layout that adds automated prebuilds
Forked from: atom/keyboard-layout
Created: 2017-12-11 04:54:00.0
Updated: 2017-12-11 05:12:54.0
Pushed: 2017-12-11 05:27:13.0
Size: 110
Language: C++
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
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.
t KeyboardLayout = require('keyboard-layout')
oardLayout.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.
t KeyboardLayout = require('keyboard-layout')
cription = KeyboardLayout.observeCurrentKeyboardLayout((layout) => console.log(layout))
cription.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()
:
t KeyboardLayout = require('keyboard-layout')
oardLayout.getCurrentKeymap()['KeyS']
US layout, this returns:
modified: 's',
thShift: 'S',
thAltGraph: 'ß',
thShiftAltGraph: 'Í'