From bc8084f3e088c2164bab31af4222706458028a6d Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Sat, 16 Dec 2023 11:07:56 +0100 Subject: [PATCH] Matrix brightness control via hotkeys https://github.com/seerge/g-helper/issues/1733 --- app/Input/InputDispatcher.cs | 10 ++++++++-- app/Settings.cs | 9 +++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/Input/InputDispatcher.cs b/app/Input/InputDispatcher.cs index 9cc0e711..31915b8c 100644 --- a/app/Input/InputDispatcher.cs +++ b/app/Input/InputDispatcher.cs @@ -634,13 +634,19 @@ namespace GHelper.Input { case 16: // FN+F7 if (Control.ModifierKeys == Keys.Shift) - SetScreenpad(-10); + { + if (AppConfig.IsDUO()) SetScreenpad(-10); + else Program.settingsForm.BeginInvoke(Program.settingsForm.CycleMatrix, -1); + } else Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.Brightness_Down, "Brightness"); break; case 32: // FN+F8 if (Control.ModifierKeys == Keys.Shift) - SetScreenpad(10); + { + if (AppConfig.IsDUO()) SetScreenpad(10); + else Program.settingsForm.BeginInvoke(Program.settingsForm.CycleMatrix, 1); + } else Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.Brightness_Up, "Brightness"); break; diff --git a/app/Settings.cs b/app/Settings.cs index 944b2f7a..f3ca3251 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -761,6 +761,15 @@ namespace GHelper } + public void CycleMatrix(int delta) + { + comboMatrix.SelectedIndex = Math.Min(Math.Max(0, comboMatrix.SelectedIndex + delta), comboMatrix.Items.Count - 1); + AppConfig.Set("matrix_brightness", comboMatrix.SelectedIndex); + matrixControl.SetMatrix(); + Program.toast.RunToast(comboMatrix.GetItemText(comboMatrix.SelectedItem), delta > 0 ? ToastIcon.BacklightUp : ToastIcon.BacklightDown); + } + + public void CycleAuraMode() { if (comboKeyboard.SelectedIndex < comboKeyboard.Items.Count - 1)