Skip to content

Commit

Permalink
Sceenpad toggle #1450
Browse files Browse the repository at this point in the history
  • Loading branch information
seerge committed Oct 20, 2023
1 parent 8c1885c commit ed5ec6b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion app/Input/InputDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ed5ec6b

Please sign in to comment.