From ed5ec6b576852d4b371a24d3a1f0098936f5e428 Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Fri, 20 Oct 2023 10:57:15 +0200 Subject: [PATCH] Sceenpad toggle https://github.com/seerge/g-helper/issues/1450 --- app/Input/InputDispatcher.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/Input/InputDispatcher.cs b/app/Input/InputDispatcher.cs index f97746357..c44f471e5 100644 --- a/app/Input/InputDispatcher.cs +++ b/app/Input/InputDispatcher.cs @@ -627,7 +627,10 @@ static void HandleOptimizationEvent(int EventID) Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.KB_Sleep, "Sleep"); break; case 106: // Screenpad button on DUO - SetScreenpad(100); + if (Control.ModifierKeys == Keys.Shift) + ToggleScreenpad(); + else + SetScreenpad(100); break; @@ -686,6 +689,16 @@ public static void SetBacklight(int delta, bool force = false) } + public static void ToggleScreenpad() + { + int toggle = AppConfig.Is("screenpad_toggle") ? 0 : 1; + + Program.acpi.DeviceSet(AsusACPI.ScreenPadToggle, toggle, "ScreenpadToggle"); + AppConfig.Set("screenpad_toggle", toggle); + Program.toast.RunToast($"Screen Pad " + (toggle == 1 ? "On" : "Off"), toggle > 0 ? ToastIcon.BrightnessUp : ToastIcon.BrightnessDown); + } + + public static void SetScreenpad(int delta) { int brightness = AppConfig.Get("screenpad", 100);