From b93f1a385b7a1256f54b01ed57c98d14605fac14 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 30 Aug 2023 23:49:32 +0200 Subject: [PATCH] Arrow lock for DUO https://github.com/seerge/g-helper/issues/1224 --- app/Input/InputDispatcher.cs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/app/Input/InputDispatcher.cs b/app/Input/InputDispatcher.cs index e04e9ab1..a6110fe8 100644 --- a/app/Input/InputDispatcher.cs +++ b/app/Input/InputDispatcher.cs @@ -131,6 +131,15 @@ namespace GHelper.Input if (AppConfig.Is("fn_lock") && !AppConfig.ContainsModel("VivoBook")) for (Keys i = Keys.F1; i <= Keys.F11; i++) hook.RegisterHotKey(ModifierKeys.None, i); + // Arrow-lock group + if (AppConfig.Is("arrow_lock") && AppConfig.IsDUO()) + { + hook.RegisterHotKey(ModifierKeys.None, Keys.Left); + hook.RegisterHotKey(ModifierKeys.None, Keys.Right); + hook.RegisterHotKey(ModifierKeys.None, Keys.Up); + hook.RegisterHotKey(ModifierKeys.None, Keys.Down); + } + } static void CustomKey(string configKey = "m3") @@ -272,6 +281,18 @@ namespace GHelper.Input case Keys.VolumeUp: KeyProcess("m2"); break; + case Keys.Left: + KeyboardHook.KeyPress(Keys.Home); + break; + case Keys.Right: + KeyboardHook.KeyPress(Keys.End); + break; + case Keys.Up: + KeyboardHook.KeyPress(Keys.PageUp); + break; + case Keys.Down: + KeyboardHook.KeyPress(Keys.PageDown); + break; default: break; } @@ -412,6 +433,15 @@ namespace GHelper.Input } } + public static void ToggleArrowLock() + { + int arLock = AppConfig.Is("arrow_lock") ? 0 : 1; + AppConfig.Set("arrow_lock", arLock); + + Program.settingsForm.BeginInvoke(Program.inputDispatcher.RegisterKeys); + Program.toast.RunToast("Arrow-Lock " + (arLock == 1 ? "On" : "Off"), ToastIcon.FnLock); + } + public static void ToggleFnLock() { int fnLock = AppConfig.Is("fn_lock") ? 0 : 1; @@ -493,6 +523,9 @@ namespace GHelper.Input case 78: // Fn + ESC ToggleFnLock(); return; + case 75: // Fn + ESC + ToggleArrowLock(); + return; case 189: // Tablet mode TabletMode(); return;