mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Fixed backlight controls for FN-Lock and Optimization Service
This commit is contained in:
@@ -187,10 +187,10 @@ namespace GHelper.Input
|
||||
KeyboardHook.KeyPress(Keys.VolumeMute);
|
||||
break;
|
||||
case Keys.F2:
|
||||
HandleEvent(197);
|
||||
SetBacklight(-1, true);
|
||||
break;
|
||||
case Keys.F3:
|
||||
HandleEvent(196);
|
||||
SetBacklight(1, true);
|
||||
break;
|
||||
case Keys.F4:
|
||||
KeyProcess("fnf4");
|
||||
@@ -323,6 +323,7 @@ namespace GHelper.Input
|
||||
{
|
||||
using (var key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\PrecisionTouchPad\Status", false))
|
||||
{
|
||||
Logger.WriteLine("Touchpad status:" + key?.GetValue("Enabled")?.ToString());
|
||||
return key?.GetValue("Enabled")?.ToString() == "1";
|
||||
}
|
||||
}
|
||||
@@ -412,9 +413,9 @@ namespace GHelper.Input
|
||||
Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.Brightness_Up, "Brightness");
|
||||
break;
|
||||
case 107: // FN+F10
|
||||
bool touchpadState = GetTouchpadState();
|
||||
AsusUSB.TouchpadToggle();
|
||||
Program.toast.RunToast(touchpadState ? "Off" : "On", ToastIcon.Touchpad);
|
||||
Thread.Sleep(50);
|
||||
Program.toast.RunToast(GetTouchpadState() ? "On" : "Off", ToastIcon.Touchpad);
|
||||
break;
|
||||
case 108: // FN+F11
|
||||
Program.acpi.DeviceSet(AsusACPI.UniversalControl, AsusACPI.KB_Sleep, "Sleep");
|
||||
@@ -445,7 +446,7 @@ namespace GHelper.Input
|
||||
AsusUSB.ApplyBrightness(GetBacklight(), "Auto");
|
||||
}
|
||||
|
||||
public static void SetBacklight(int delta)
|
||||
public static void SetBacklight(int delta, bool force = false)
|
||||
{
|
||||
int backlight_power = AppConfig.Get("keyboard_brightness", 1);
|
||||
int backlight_battery = AppConfig.Get("keyboard_brightness_ac", 1);
|
||||
@@ -463,13 +464,14 @@ namespace GHelper.Input
|
||||
else
|
||||
AppConfig.Set("keyboard_brightness", backlight);
|
||||
|
||||
if (!OptimizationService.IsRunning())
|
||||
if (force || !OptimizationService.IsRunning())
|
||||
{
|
||||
AsusUSB.ApplyBrightness(backlight, "HotKey");
|
||||
string[] backlightNames = new string[] { "Off", "Low", "Mid", "Max" };
|
||||
Program.toast.RunToast(backlightNames[backlight], delta > 0 ? ToastIcon.BacklightUp : ToastIcon.BacklightDown);
|
||||
}
|
||||
|
||||
string[] backlightNames = new string[] { "Off", "Low", "Mid", "Max" };
|
||||
Program.toast.RunToast(backlightNames[backlight], delta > 0 ? ToastIcon.BacklightUp : ToastIcon.BacklightDown);
|
||||
|
||||
}
|
||||
|
||||
static void LaunchProcess(string command = "")
|
||||
|
||||
Reference in New Issue
Block a user