Skip to content

Commit

Permalink
Merge pull request #818 from Dygmalab/fixSuperkeyRemoveDeleted
Browse files Browse the repository at this point in the history
fix: superkeys replace process now works as expected when saving new …
  • Loading branch information
alexpargon authored Jul 2, 2024
2 parents bb136b5 + f927592 commit 98fcec8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Bazecor",
"productName": "Bazecor",
"version": "1.4.0-rc.5",
"version": "1.4.0-rc.6",
"description": "Bazecor desktop app",
"private": true,
"repository": {
Expand Down
13 changes: 8 additions & 5 deletions src/renderer/views/SuperkeysEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ function SuperkeysEditor(props: SuperkeysEditorProps) {
return Array(512).fill("65535").join(" ");
}
let keyMap = JSON.parse(JSON.stringify(superkeys));
// log.info("First", JSON.stringify(keyMap));
log.info("First", JSON.stringify(keyMap));
keyMap = keyMap.map((sky: SuperkeysType) => {
const sk = sky;
sk.actions = sk.actions.map(act => {
Expand All @@ -422,7 +422,7 @@ function SuperkeysEditor(props: SuperkeysEditorProps) {
if (sk.actions.length < 5) sk.actions = sk.actions.concat(Array(5 - sk.actions.length).fill(1));
return sk;
});
// log.info("Third", JSON.parse(JSON.stringify(keyMap)));
log.info("Third", JSON.parse(JSON.stringify(keyMap)));
const mapped = keyMap
.map((superkey: SuperkeysType) => superkey.actions.filter(act => act !== 0).concat([0]))
.flat()
Expand Down Expand Up @@ -503,12 +503,15 @@ function SuperkeysEditor(props: SuperkeysEditorProps) {
log.info("Loaded neurons: ", JSON.stringify(localNeurons));
try {
store.set("neurons", localNeurons);
await currentDevice.command("superkeys.map", superkeyMap(superkeys));
const sendSK = superkeyMap(superkeys);
log.info("Mod superK", sendSK);
await currentDevice.command("superkeys.map", sendSK);
if (modifiedKeymap) {
const args = flatten(keymap.custom)
.map(k => keymapDB.serialize(k))
.toString();
await currentDevice.command("keymap.custom", ...args);
.join(" ");
log.info("Mod keymap", args);
await currentDevice.command("keymap.custom", args);
}
state.modified = false;
state.modifiedKeymap = false;
Expand Down

0 comments on commit 98fcec8

Please sign in to comment.