diff --git a/src/web/BindingsWaiter.js b/src/web/BindingsWaiter.js
index 8c06e18a..2454ed59 100644
--- a/src/web/BindingsWaiter.js
+++ b/src/web/BindingsWaiter.js
@@ -23,7 +23,9 @@ const BindingsWaiter = function (app, manager) {
* @param {event} e
*/
BindingsWaiter.prototype.parseInput = function(e) {
- if (e.ctrlKey && e.altKey) {
+ let modKey = e.altKey;
+ if (this.app.options.useMetaKey) modKey = e.metaKey;
+ if (e.ctrlKey && modKey) {
let elem;
switch (e.code) {
case "KeyF":
@@ -115,4 +117,88 @@ BindingsWaiter.prototype.parseInput = function(e) {
}
};
+/**
+ * Updates keybinding list when metaKey option is toggled
+ *
+ */
+BindingsWaiter.prototype.updateKeybList = function() {
+ let modWinLin = "Alt";
+ let modMac = "Opt";
+ if (this.app.options.useMetaKey) {
+ modWinLin = "Win";
+ modMac = "Cmd";
+ }
+ document.getElementById("keybList").innerHTML = `
+
+ Command |
+ Shortcut (Win/Linux) |
+ Shortcut (Mac) |
+
+
+ Place cursor in search field |
+ Ctrl+${modWinLin}+f |
+ Ctrl+${modMac}+f |
+
+ Place cursor in input box |
+ Ctrl+${modWinLin}+i |
+ Ctrl+${modMac}+i |
+
+
+ Place cursor in output box |
+ Ctrl+${modWinLin}+o |
+ Ctrl+${modMac}+o |
+
+
+ Place cursor in first argument field of the next operation in the recipe |
+ Ctrl+${modWinLin}+. |
+ Ctrl+${modMac}+. |
+
+
+ Place cursor in first argument field of the nth operation in the recipe |
+ Ctrl+${modWinLin}+[1-9] |
+ Ctrl+${modMac}+[1-9] |
+
+
+ Disable current operation |
+ Ctrl+${modWinLin}+d |
+ Ctrl+${modMac}+d |
+
+
+ Set/clear breakpoint |
+ Ctrl+${modWinLin}+b |
+ Ctrl+${modMac}+b |
+
+
+ Bake |
+ Ctrl+${modWinLin}+Space |
+ Ctrl+${modMac}+Space |
+
+
+ Step |
+ Ctrl+${modWinLin}+' |
+ Ctrl+${modMac}+' |
+
+
+ Clear recipe |
+ Ctrl+${modWinLin}+c |
+ Ctrl+${modMac}+c |
+
+
+ Save to file |
+ Ctrl+${modWinLin}+s |
+ Ctrl+${modMac}+s |
+
+
+ Load recipe |
+ Ctrl+${modWinLin}+l |
+ Ctrl+${modMac}+l |
+
+
+ Move output to input |
+ Ctrl+${modWinLin}+m |
+ Ctrl+${modMac}+m |
+
+ `;
+};
+
export default BindingsWaiter;
diff --git a/src/web/Manager.js b/src/web/Manager.js
index de1df8e4..e0a0ef37 100755
--- a/src/web/Manager.js
+++ b/src/web/Manager.js
@@ -78,6 +78,7 @@ Manager.prototype.setup = function() {
this.recipe.initialiseOperationDragNDrop();
this.controls.autoBakeChange();
this.seasonal.load();
+ this.bindings.updateKeybList();
};
@@ -91,7 +92,6 @@ Manager.prototype.initialiseEventListeners = function() {
window.addEventListener("focus", this.window.windowFocus.bind(this.window));
window.addEventListener("statechange", this.app.stateChange.bind(this.app));
window.addEventListener("popstate", this.app.popState.bind(this.app));
- window.addEventListener("keydown", this.bindings.parseInput.bind(this.bindings));
// Controls
document.getElementById("bake").addEventListener("click", this.controls.bakeClick.bind(this.controls));
document.getElementById("auto-bake").addEventListener("change", this.controls.autoBakeChange.bind(this.controls));
@@ -166,6 +166,10 @@ Manager.prototype.initialiseEventListeners = function() {
this.addDynamicListener(".option-item select", "change", this.options.selectChange, this.options);
document.getElementById("theme").addEventListener("change", this.options.themeChange.bind(this.options));
+ //Keybindings
+ window.addEventListener("keydown", this.bindings.parseInput.bind(this.bindings));
+ $(document).on("switchChange.bootstrapSwitch", ".option-item input:checkbox#useMetaKey", this.bindings.updateKeybList.bind(this.bindings));
+
// Misc
document.getElementById("alert-close").addEventListener("click", this.app.alertCloseClick.bind(this.app));
};
diff --git a/src/web/html/index.html b/src/web/html/index.html
index c968ebfe..0bf52c53 100755
--- a/src/web/html/index.html
+++ b/src/web/html/index.html
@@ -325,6 +325,10 @@
+
+
+
+
@@ -402,8 +406,7 @@
About
-
-
+
Keybindings
@@ -482,77 +485,7 @@
It’s the Cyber Swiss Army Knife.
-
-
- Command |
- Shortcut (Win/Linux) |
- Shortcut (Mac) |
-
-
- Place cursor in search field |
- Ctrl+Alt+f |
- Ctrl+Opt+f |
-
- Place cursor in input box |
- Ctrl+Alt+i |
- Ctrl+Opt+i |
-
-
- Place cursor in output box |
- Ctrl+Alt+o |
- Ctrl+Opt+o |
-
-
- Place cursor in first argument field of the next operation in the recipe |
- Ctrl+Alt+. |
- Ctrl+Opt+. |
-
-
- Place cursor in first argument field of the nth operation in the recipe |
- Ctrl+Alt+[1-9] |
- Ctrl+Opt+[1-9] |
-
-
- Disable current operation |
- Ctrl+Alt+d |
- Ctrl+Opt+d |
-
-
- Set/clear breakpoint |
- Ctrl+Alt+b |
- Ctrl+Opt+b |
-
-
- Bake |
- Ctrl+Alt+Space |
- Ctrl+Opt+Space |
-
-
- Step |
- Ctrl+Alt+' |
- Ctrl+Opt+' |
-
-
- Clear recipe |
- Ctrl+Alt+c |
- Ctrl+Opt+c |
-
-
- Save to file |
- Ctrl+Alt+s |
- Ctrl+Opt+s |
-
-
- Load recipe |
- Ctrl+Alt+l |
- Ctrl+Opt+l |
-
-
- Move output to input |
- Ctrl+Alt+m |
- Ctrl+Opt+m |
-
-
+
diff --git a/src/web/index.js b/src/web/index.js
index 80da5733..5964b1e8 100755
--- a/src/web/index.js
+++ b/src/web/index.js
@@ -46,6 +46,7 @@ function main() {
errorTimeout: 4000,
attemptHighlight: true,
theme: "classic",
+ useMetaKey: false
};
document.removeEventListener("DOMContentLoaded", main, false);