summaryrefslogtreecommitdiff
path: root/ext/bg/js/settings/scan-inputs-simple-controller.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-01-18 13:52:07 -0500
committerGitHub <noreply@github.com>2021-01-18 13:52:07 -0500
commitb0f0ecd7df7694e14f08c6cf376a964abe7ee7f5 (patch)
tree7b7c1d0c5ce3149bb93ea07f6738bf38312d180a /ext/bg/js/settings/scan-inputs-simple-controller.js
parent25568637fe82988522ddd5c4d8642702b898a293 (diff)
Hotkey util (#1270)
* Create HotkeyUtil * Create tests * Use HotkeyUtil * Fix issues
Diffstat (limited to 'ext/bg/js/settings/scan-inputs-simple-controller.js')
-rw-r--r--ext/bg/js/settings/scan-inputs-simple-controller.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/ext/bg/js/settings/scan-inputs-simple-controller.js b/ext/bg/js/settings/scan-inputs-simple-controller.js
index 9e7eb5fc..01f044c2 100644
--- a/ext/bg/js/settings/scan-inputs-simple-controller.js
+++ b/ext/bg/js/settings/scan-inputs-simple-controller.js
@@ -16,7 +16,7 @@
*/
/* global
- * DocumentUtil
+ * HotkeyUtil
* ScanInputsController
* api
*/
@@ -27,7 +27,7 @@ class ScanInputsSimpleController {
this._middleMouseButtonScan = null;
this._mainScanModifierKeyInput = null;
this._mainScanModifierKeyInputHasOther = false;
- this._os = null;
+ this._hotkeyUtil = new HotkeyUtil();
}
async prepare() {
@@ -35,7 +35,7 @@ class ScanInputsSimpleController {
this._mainScanModifierKeyInput = document.querySelector('#main-scan-modifier-key');
const {platform: {os}} = await api.getEnvironmentInfo();
- this._os = os;
+ this._hotkeyUtil.os = os;
this._mainScanModifierKeyInputHasOther = false;
this._populateSelect(this._mainScanModifierKeyInput, this._mainScanModifierKeyInputHasOther);
@@ -106,9 +106,12 @@ class ScanInputsSimpleController {
_populateSelect(select, hasOther) {
const modifierKeys = [
- {value: 'none', name: 'No key'},
- ...DocumentUtil.getModifierKeys(this._os).map(([value, name]) => ({value, name}))
+ {value: 'none', name: 'No key'}
];
+ for (const value of ['alt', 'ctrl', 'shift', 'meta']) {
+ const name = this._hotkeyUtil.getModifierDisplayValue(value);
+ modifierKeys.push({value, name});
+ }
if (hasOther) {
modifierKeys.push({value: 'other', name: 'Other'});