Created
April 13, 2020 01:46
-
-
Save razzius/d2a52d478d868a188607042b756e037c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="utf-8" /> | |
</head> | |
<body> | |
<script> | |
function parseKeyname(keyname) { | |
const parts = keyname.toLowerCase().split('-') | |
const modifiers = parts.slice(0, -1) | |
const key = parts[parts.length - 1] | |
return { | |
meta: modifiers.includes('m'), | |
control: modifiers.includes('c'), | |
super: modifiers.includes('s'), | |
key: key, | |
} | |
} | |
const keybindings = { | |
'M-RET': 'c-s-s', | |
} | |
function keybindingName({ meta, control, super, key }) { | |
// order: C-M-S-key | |
parts = [control, meta, super] | |
} | |
// function rebindKey(from, to) {} | |
document.onkeydown = (e) => { | |
console.log('keydown') | |
console.log(e) | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment