separate handling for renderer keybinds

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

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

@ -8,7 +8,14 @@ module.exports = () => {
ipc.sendSync('keybind', message);
};
Object.keys(binds).forEach((bind) => {
mousetrap.bind(bind, () => sendIpcMessage(binds[bind]));
const process = binds.process;
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