From 6ab6d5884b715560f789a114cdb8e0d98d2e0940 Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Wed, 29 Jun 2022 21:20:28 +1000
Subject: Add setting for disabling keyboard shortcuts

Avoid showing the setting on touch devices
---
 src/components/SettingsModal.vue | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'src/components/SettingsModal.vue')

diff --git a/src/components/SettingsModal.vue b/src/components/SettingsModal.vue
index 6512aa4..20259e9 100644
--- a/src/components/SettingsModal.vue
+++ b/src/components/SettingsModal.vue
@@ -85,6 +85,10 @@
 				<label> <input type="checkbox" v-model="uiOpts.searchJumpMode"
 					@change="onSettingChg('UI', 'searchJumpMode')"/> Skip search animation </label>
 			</div>
+			<div v-if="!onTouchDevice">
+				<label> <input type="checkbox" v-model="uiOpts.disableShortcuts"
+					@change="onSettingChg('UI', 'disableShortcuts')"/> Disable keyboard shortcuts </label>
+			</div>
 		</div>
 		<s-button class="mx-auto mt-2" :style="{color: uiOpts.textColor, backgroundColor: uiOpts.bgColor}"
 			@click="onResetAll">
@@ -105,6 +109,7 @@ import SButton from './SButton.vue';
 import CloseIcon from './icon/CloseIcon.vue';
 import {UiOptions, OptionType, getDefaultLytOpts, getDefaultUiOpts} from '../lib';
 import {LayoutOptions} from '../layout';
+import {onTouchDevice} from '../util';
 
 export default defineComponent({
 	props: {
@@ -113,10 +118,11 @@ export default defineComponent({
 	},
 	data(){
 		return {
-			saved: false, // Set to true after a setting is saved
 			sweepLeaves: this.lytOpts.layoutType == 'sweep',
 				// For making only two of 'layoutType's values available for user selection
+			saved: false, // Set to true after a setting is saved
 			settingChgTimeout: 0, // Use to throttle some setting-change handling
+			onTouchDevice: onTouchDevice(),
 		};
 	},
 	computed: {
-- 
cgit v1.2.3

