Put module bindings inside of layers, not the other way around. Use IDs instead of strings for identifying modules. Update script.
This commit is contained in:
@@ -8,8 +8,8 @@ buffer.fill(0);
|
|||||||
var writer = BufferWriter(buffer);
|
var writer = BufferWriter(buffer);
|
||||||
|
|
||||||
var uhkConfig = JSON.parse(fs.readFileSync('uhk-config.json'));
|
var uhkConfig = JSON.parse(fs.readFileSync('uhk-config.json'));
|
||||||
var keyActions = uhkConfig.keymaps[0].modules[0].layers[0].keyActions;
|
var keyActions = uhkConfig.keymaps[0].layers[0].modules[0].keyActions;
|
||||||
|
console.log(keyActions)
|
||||||
var ARRAY_LAST_ELEMENT_ID = 0;
|
var ARRAY_LAST_ELEMENT_ID = 0;
|
||||||
|
|
||||||
var KEY_ACTION_ID_KEYSTROKE_SCANCODE_FIRST = 1;
|
var KEY_ACTION_ID_KEYSTROKE_SCANCODE_FIRST = 1;
|
||||||
@@ -61,10 +61,10 @@ function serializeKeyAction(keyAction) {
|
|||||||
case 'none':
|
case 'none':
|
||||||
serializeNoneAction();
|
serializeNoneAction();
|
||||||
break;
|
break;
|
||||||
case 'key':
|
case 'keystroke':
|
||||||
serializeKeystrokeAction(keyAction);
|
serializeKeystrokeAction(keyAction);
|
||||||
break;
|
break;
|
||||||
case 'dualRoleKey':
|
case 'dualRoleKeystroke':
|
||||||
serializeDualRoleKeyAction(keyAction);
|
serializeDualRoleKeyAction(keyAction);
|
||||||
break;
|
break;
|
||||||
case 'mouse':
|
case 'mouse':
|
||||||
@@ -76,8 +76,11 @@ function serializeKeyAction(keyAction) {
|
|||||||
case 'switchKeymap':
|
case 'switchKeymap':
|
||||||
serializeSwitchKeymapAction(keyAction);
|
serializeSwitchKeymapAction(keyAction);
|
||||||
break;
|
break;
|
||||||
|
case 'switchLayer':
|
||||||
|
serializeSwitchLayerAction(keyAction);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw "KeyAction doesn't have a valid actionType property!";
|
throw "KeyAction doesn't have a valid actionType property: " + keyAction.actionType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,5 +140,14 @@ function serializeSwitchKeymapAction(switchKeymapAction) {
|
|||||||
writer.uint8(switchKeymapAction.keymapId);
|
writer.uint8(switchKeymapAction.keymapId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function serializeSwitchLayerAction(switchLayerAction) {
|
||||||
|
writer.uint8({
|
||||||
|
mod : KEY_ACTION_ID_SWITCH_LAYER_MOD,
|
||||||
|
fn : KEY_ACTION_ID_SWITCH_LAYER_FN,
|
||||||
|
mouse: KEY_ACTION_ID_SWITCH_LAYER_MOUSE
|
||||||
|
}[switchLayerAction]);
|
||||||
|
writer.uint8(0);
|
||||||
|
}
|
||||||
|
|
||||||
serializeKeyActions(keyActions);
|
serializeKeyActions(keyActions);
|
||||||
fs.writeFileSync('uhk-config.bin', buffer);
|
fs.writeFileSync('uhk-config.bin', buffer);
|
||||||
|
|||||||
@@ -14,12 +14,14 @@
|
|||||||
"name": "QWERTY",
|
"name": "QWERTY",
|
||||||
"isDefault": true,
|
"isDefault": true,
|
||||||
"abbreviation": "QTY",
|
"abbreviation": "QTY",
|
||||||
"modules": [
|
"layers": [
|
||||||
{
|
{
|
||||||
"name": "uhkLeft",
|
"modules": [
|
||||||
"layers": [
|
|
||||||
{
|
{
|
||||||
"pointerRole": "move",
|
"id": 0,
|
||||||
|
"pointerRoles": [
|
||||||
|
"move"
|
||||||
|
],
|
||||||
"keyActions": [
|
"keyActions": [
|
||||||
{
|
{
|
||||||
"actionType": "none"
|
"actionType": "none"
|
||||||
@@ -52,38 +54,28 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{},
|
{
|
||||||
{},
|
"id": 1
|
||||||
{}
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"pointerRoles": [
|
||||||
|
"scroll"
|
||||||
|
],
|
||||||
|
"keyActions": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"pointerRoles": [
|
||||||
|
"move"
|
||||||
|
],
|
||||||
|
"keyActions": []
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{},
|
||||||
"name": "uhkRight"
|
{},
|
||||||
},
|
{}
|
||||||
{
|
|
||||||
"name": "keyClusterLeft",
|
|
||||||
"layers": [
|
|
||||||
{
|
|
||||||
"pointerRole": "scroll",
|
|
||||||
"keyActions": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"modLayer": {},
|
|
||||||
"fnLayer": {},
|
|
||||||
"mouseLayer": {}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "trackballRight",
|
|
||||||
"layers": [
|
|
||||||
{
|
|
||||||
"pointerRole": "move",
|
|
||||||
"keyActions": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"modLayer": {},
|
|
||||||
"fnLayer": {},
|
|
||||||
"mouseLayer": {}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user