separate handling for renderer keybinds

toast
Kit Kasune 3 years ago
parent b54dd68214
commit afa130030e
  1. 5
      json/shortcuts.json
  2. 11
      scripts/keybinds/handleKey.js

@ -1,5 +1,10 @@
{ {
"process": {
"ctrl+r": "reload", "ctrl+r": "reload",
"command+r": "reload", "command+r": "reload",
"ctrl+shift+i": "devtool" "ctrl+shift+i": "devtool"
},
"renderer": {
"ctrl+n": "newfolder"
}
} }

@ -8,7 +8,14 @@ module.exports = () => {
ipc.sendSync('keybind', message); ipc.sendSync('keybind', message);
}; };
Object.keys(binds).forEach((bind) => { const process = binds.process;
mousetrap.bind(bind, () => sendIpcMessage(binds[bind])); const renderer = binds.renderer;
Object.keys(process).forEach((bind) => {
mousetrap.bind(bind, () => sendIpcMessage(process[bind]));
});
Object.keys(renderer).forEach((bind) => {
mousetrap.bind(bind, require(`./renderer/${renderer[bind]}`));
}); });
}; };
Loading…
Cancel
Save