cathalo
(cathalo)
1
Question Description
Have you searched the community for related issues?
- [*] No similar issues found.
Please describe the problem you’ve encountered in detail:
I want to remap caps lock to escape, and ideally remap escape to caps lock also (not that important to me).
System & Device Information
Chromium: Version 126.0.6478.191 (64-bit)
Platform: 15886.67.19.2 (Developer Build - root) stable-channel amd64-openfyde
Channel: stable-channel
Firmware Version:
ARC Enabled: false
ARC:
Enterprise Enrolled: false
Developer Mode: true
Note: If you’ve lost your FydeOS subscription, please refer to this FAQ for assistance.
cathalo
(cathalo)
2
I found a hack to fix this. I created a custom extension from https://github.com/google/extra-keyboards-for-chrome-os/tree/master/capslockremap as a base. Just use the following as the background.js instead:
let contextID = -1;
let lastRemappedKeyEvent = undefined;
let ctrlKey = false;
chrome.input.ime.onFocus.addListener(function(context) {
contextID = context.contextID;
});
chrome.input.ime.onBlur.addListener(function(context) {
contextID = -1;
});
function isCapsLock(keyData) {
return (keyData.code == "CapsLock");
};
chrome.input.ime.onKeyEvent.addListener(
function(engineID, keyData) {
let handled = false;
if (isCapsLock(keyData)) {
keyData.code = "Escape";
keyData.key = "Escape";
keyData.capsLock = false;
chrome.input.ime.sendKeyEvents({"contextID": contextID, "keyData": [keyData]});
handled = true;
}
return handled;
});