Compare commits

...

32 Commits

Author SHA1 Message Date
Serge
5570513eeb Merge branch 'main' of https://github.com/seerge/g-helper 2024-11-03 11:02:21 +01:00
Serge
ceb1c9a250 Skip auto-backlight when lid is closed https://github.com/seerge/g-helper/issues/3335 2024-11-03 11:02:18 +01:00
Serge
e942d3fd49 Added website link 2024-10-31 11:10:09 +01:00
Serge
482fe00014 Version bump 2024-10-30 08:37:35 +01:00
Serge
54fdf9231c Custom mode hotkeys https://github.com/seerge/g-helper/issues/3323 2024-10-29 19:46:16 +01:00
Serge
b9be9a9c97 Added FN+F5 keycode for ancient devices https://github.com/seerge/g-helper/discussions/3322 2024-10-29 18:36:48 +01:00
Serge
501d0a1666 Matrix clock position tweak #3304 2024-10-29 18:34:56 +01:00
Serge
a7e50f89ca Cleanup 2024-10-28 16:21:58 +01:00
Serge
083e918086 Fix possible exception in battery fully charged https://github.com/seerge/g-helper/issues/3317 2024-10-28 16:19:05 +01:00
Serge
e6a547dbfd Animematrix clock position tweak https://github.com/seerge/g-helper/issues/3304 2024-10-28 15:23:47 +01:00
Serge
1321b2eb31 Init Screenpad brightness on start https://github.com/seerge/g-helper/issues/3301 2024-10-26 15:10:26 +02:00
Serge
5e96e3e9bc Option to skip PowerMode setting https://github.com/seerge/g-helper/issues/3287 2024-10-25 22:24:21 +02:00
Serge
5e4bd13aa9 Added GX501G to NoWMI list https://github.com/seerge/g-helper/discussions/3300 2024-10-25 22:19:11 +02:00
Serge
f320da9245 GPU mode toast notifications https://github.com/seerge/g-helper/issues/3286 2024-10-23 13:32:30 +02:00
Serge
a024c05bc1 Backlight tweaks 2024-10-23 13:29:12 +02:00
Serge
15501c7845 Animatrix picture editor tweaks https://github.com/seerge/g-helper/issues/3280 2024-10-22 17:49:37 +02:00
Serge
011fdeeb36 Version bump 2024-10-22 17:10:53 +02:00
Serge
3df0aa04de Ctrl+Shift+Alt+F7/F8 to control screenpad brightness https://github.com/seerge/g-helper/issues/3281 2024-10-22 12:08:47 +02:00
Serge
9f364a331c Assigned FN+F to toggle modes on Zenbook DUO https://github.com/seerge/g-helper/issues/3281 2024-10-22 11:44:42 +02:00
Serge
08af10afef Merge branch 'main' of https://github.com/seerge/g-helper 2024-10-22 10:50:09 +02:00
Serge
4ea59d2669 Added UX840 to the list of DUO models https://github.com/seerge/g-helper/issues/3281 2024-10-22 10:50:07 +02:00
Serge
5eb0c1d095 Increased startup delay to 2 seconds https://github.com/seerge/g-helper/issues/3275 2024-10-21 13:38:06 +02:00
Serge
a8c32470b3 Option to override maximum refresh rate #3261 2024-10-15 10:41:48 +02:00
Serge
45709eb7d6 Option to override minimum refresh rate https://github.com/seerge/g-helper/issues/3261 2024-10-14 21:38:04 +02:00
Serge
ecbd926d81 Added Vivobook S16 M5606 to OLED list #3265 2024-10-14 18:48:44 +02:00
Serge
1cca7a5881 Restart input listener if connection was dropped https://github.com/seerge/g-helper/issues/3249 2024-10-13 17:59:23 +02:00
Serge
0d3332faf3 Version bump 2024-10-12 15:42:46 +02:00
Serge
aa74730e12 Toggle between % and Wh for battery charge https://github.com/seerge/g-helper/issues/3246 2024-10-11 18:06:15 +02:00
Serge
9b5e2acf90 Show remaining battery charge in Wh https://github.com/seerge/g-helper/issues/3246 2024-10-11 15:14:36 +02:00
Serge
3fafe63c42 Visual Mode handling 2024-10-11 11:56:39 +02:00
Serge
6c0252156c Option to disable Visual Mode 2024-10-11 11:15:03 +02:00
Serge
3a750c08b5 Added G834JZR to mini-led init list https://github.com/seerge/g-helper/issues/2802 2024-10-11 10:50:56 +02:00
16 changed files with 199 additions and 94 deletions

2
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,2 @@
# These are supported funding model platforms
custom: https://g-helper.com/support

View File

@@ -213,7 +213,7 @@ namespace GHelper.AnimeMatrix
switch (running) switch (running)
{ {
case 2: case 2:
SetMatrixPicture(AppConfig.GetString("matrix_picture")); SetMatrixPicture(AppConfig.GetString("matrix_picture"), false);
break; break;
case 3: case 3:
SetMatrixClock(); SetMatrixClock();

View File

@@ -410,7 +410,7 @@ namespace GHelper.AnimeMatrix
if (DateTime.Now.Second % 2 != 0) timeFormat = timeFormat.Replace(":", " "); if (DateTime.Now.Second % 2 != 0) timeFormat = timeFormat.Replace(":", " ");
Clear(); Clear();
Text(DateTime.Now.ToString(timeFormat), 15, 2, 25); Text(DateTime.Now.ToString(timeFormat), 15, 7 - FullRows / 2, 25);
Text(DateTime.Now.ToString(dateFormat), 11.5F, 0, 14); Text(DateTime.Now.ToString(dateFormat), 11.5F, 0, 14);
Present(); Present();

View File

@@ -413,7 +413,7 @@ public static class AppConfig
public static bool IsDUO() public static bool IsDUO()
{ {
return ContainsModel("Duo") || ContainsModel("GX550") || ContainsModel("GX650"); return ContainsModel("Duo") || ContainsModel("GX550") || ContainsModel("GX650") || ContainsModel("UX840");
} }
// G14 2020 has no aura, but media keys instead // G14 2020 has no aura, but media keys instead
@@ -454,7 +454,7 @@ public static class AppConfig
public static bool IsOLED() public static bool IsOLED()
{ {
return ContainsModel("OLED") || IsSlash() || ContainsModel("M7600") || ContainsModel("UX64") || ContainsModel("UX34") || ContainsModel("UX53") || ContainsModel("K360") || ContainsModel("X150") || ContainsModel("M350") || ContainsModel("K650") || ContainsModel("UM53") || ContainsModel("K660") || ContainsModel("UX84") || ContainsModel("M650") || ContainsModel("M550") || ContainsModel("K340") || ContainsModel("K350") || ContainsModel("M140") || ContainsModel("UM340") || ContainsModel("S540") || ContainsModel("M7400") || ContainsModel("N650") || ContainsModel("HN7306") || ContainsModel("H7606") || ContainsModel("UX5406") || ContainsModel("UM5606"); return ContainsModel("OLED") || IsSlash() || ContainsModel("M7600") || ContainsModel("UX64") || ContainsModel("UX34") || ContainsModel("UX53") || ContainsModel("K360") || ContainsModel("X150") || ContainsModel("M350") || ContainsModel("K650") || ContainsModel("UM53") || ContainsModel("K660") || ContainsModel("UX84") || ContainsModel("M650") || ContainsModel("M550") || ContainsModel("K340") || ContainsModel("K350") || ContainsModel("M140") || ContainsModel("UM340") || ContainsModel("S540") || ContainsModel("M7400") || ContainsModel("N650") || ContainsModel("HN7306") || ContainsModel("H7606") || ContainsModel("UX5406") || ContainsModel("M5606");
} }
public static bool IsNoOverdrive() public static bool IsNoOverdrive()
@@ -504,7 +504,7 @@ public static class AppConfig
public static bool NoWMI() public static bool NoWMI()
{ {
return ContainsModel("GL704G") || ContainsModel("GM501G"); return ContainsModel("GL704G") || ContainsModel("GM501G") || ContainsModel("GX501G");
} }
public static bool IsNoDirectRGB() public static bool IsNoDirectRGB()
@@ -696,7 +696,7 @@ public static class AppConfig
public static bool IsForceMiniled() public static bool IsForceMiniled()
{ {
return ContainsModel("G834JYR") || Is("force_miniled"); return ContainsModel("G834JYR") || ContainsModel("G834JZR") || Is("force_miniled");
} }
public static bool SaveDimming() public static bool SaveDimming()

View File

@@ -2,31 +2,46 @@
namespace GHelper.Battery namespace GHelper.Battery
{ {
internal class BatteryControl public static class BatteryControl
{ {
static bool _chargeFull = AppConfig.Is("charge_full");
public static bool chargeFull
{
get
{
return _chargeFull;
}
set
{
AppConfig.Set("charge_full", value ? 1 : 0);
_chargeFull = value;
}
}
public static void ToggleBatteryLimitFull() public static void ToggleBatteryLimitFull()
{ {
if (AppConfig.Is("charge_full")) SetBatteryChargeLimit(); if (chargeFull) SetBatteryChargeLimit();
else SetBatteryLimitFull(); else SetBatteryLimitFull();
} }
public static void SetBatteryLimitFull() public static void SetBatteryLimitFull()
{ {
AppConfig.Set("charge_full", 1); chargeFull = true;
Program.acpi.DeviceSet(AsusACPI.BatteryLimit, 100, "BatteryLimit"); Program.acpi.DeviceSet(AsusACPI.BatteryLimit, 100, "BatteryLimit");
Program.settingsForm.VisualiseBatteryFull(); Program.settingsForm.VisualiseBatteryFull();
} }
public static void UnSetBatteryLimitFull() public static void UnSetBatteryLimitFull()
{ {
AppConfig.Set("charge_full", 0); chargeFull = false;
Logger.WriteLine("Battery fully charged");
Program.settingsForm.Invoke(Program.settingsForm.VisualiseBatteryFull); Program.settingsForm.Invoke(Program.settingsForm.VisualiseBatteryFull);
} }
public static void AutoBattery(bool init = false) public static void AutoBattery(bool init = false)
{ {
if (AppConfig.Is("charge_full") && !init) SetBatteryLimitFull(); if (chargeFull && !init) SetBatteryLimitFull();
else SetBatteryChargeLimit(); else SetBatteryChargeLimit();
} }
@@ -46,7 +61,7 @@ namespace GHelper.Battery
Program.acpi.DeviceSet(AsusACPI.BatteryLimit, limit, "BatteryLimit"); Program.acpi.DeviceSet(AsusACPI.BatteryLimit, limit, "BatteryLimit");
AppConfig.Set("charge_limit", limit); AppConfig.Set("charge_limit", limit);
AppConfig.Set("charge_full", 0); chargeFull = false;
Program.settingsForm.VisualiseBattery(limit); Program.settingsForm.VisualiseBattery(limit);
} }

View File

@@ -6,7 +6,14 @@ namespace GHelper.Display
{ {
public const int MAX_REFRESH = 1000; public const int MAX_REFRESH = 1000;
public static int MIN_RATE = AppConfig.Get("min_rate", 60);
public static int MAX_RATE = AppConfig.Get("max_rate");
public static int GetMaxRate(string? laptopScreen)
{
if (MAX_RATE > 0) return MAX_RATE;
else return ScreenNative.GetMaxRefreshRate(laptopScreen);
}
public void AutoScreen(bool force = false) public void AutoScreen(bool force = false)
{ {
@@ -15,7 +22,7 @@ namespace GHelper.Display
if (SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Online) if (SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Online)
SetScreen(MAX_REFRESH, 1); SetScreen(MAX_REFRESH, 1);
else else
SetScreen(60, 0); SetScreen(MIN_RATE, 0);
} }
else else
{ {
@@ -29,7 +36,7 @@ namespace GHelper.Display
var refreshRate = ScreenNative.GetRefreshRate(laptopScreen); var refreshRate = ScreenNative.GetRefreshRate(laptopScreen);
if (refreshRate < 0) return; if (refreshRate < 0) return;
ScreenNative.SetRefreshRate(laptopScreen, refreshRate > 60 ? 60 : ScreenNative.GetMaxRefreshRate(laptopScreen)); ScreenNative.SetRefreshRate(laptopScreen, refreshRate > MIN_RATE ? MIN_RATE : GetMaxRate(laptopScreen));
InitScreen(); InitScreen();
} }
@@ -43,7 +50,7 @@ namespace GHelper.Display
if (frequency >= MAX_REFRESH) if (frequency >= MAX_REFRESH)
{ {
frequency = ScreenNative.GetMaxRefreshRate(laptopScreen); frequency = GetMaxRate(laptopScreen);
} }
if (frequency > 0 && frequency != refreshRate) if (frequency > 0 && frequency != refreshRate)
@@ -151,7 +158,7 @@ namespace GHelper.Display
{ {
var laptopScreen = ScreenNative.FindLaptopScreen(); var laptopScreen = ScreenNative.FindLaptopScreen();
int frequency = ScreenNative.GetRefreshRate(laptopScreen); int frequency = ScreenNative.GetRefreshRate(laptopScreen);
int maxFrequency = ScreenNative.GetMaxRefreshRate(laptopScreen); int maxFrequency = GetMaxRate(laptopScreen);
if (maxFrequency > 0) AppConfig.Set("max_frequency", maxFrequency); if (maxFrequency > 0) AppConfig.Set("max_frequency", maxFrequency);
else maxFrequency = AppConfig.Get("max_frequency"); else maxFrequency = AppConfig.Get("max_frequency");

View File

@@ -1,4 +1,5 @@
using GHelper.Helpers; using GHelper.Helpers;
using Microsoft.Win32;
using System.Management; using System.Management;
namespace GHelper.Display namespace GHelper.Display
@@ -37,6 +38,7 @@ namespace GHelper.Display
Cinema = 25, Cinema = 25,
Vivid = 13, Vivid = 13,
Eyecare = 17, Eyecare = 17,
Disabled = 18,
} }
public static class VisualControl public static class VisualControl
{ {
@@ -99,7 +101,7 @@ namespace GHelper.Display
foreach (FileInfo icm in icms) foreach (FileInfo icm in icms)
{ {
//Logger.WriteLine(icm.FullName); //Logger.WriteLine(icm.FullName);
if (icm.Name.Contains("sRGB")) if (icm.Name.Contains("sRGB"))
{ {
try try
@@ -107,7 +109,7 @@ namespace GHelper.Display
_modes.Add(isVivo ? SplendidGamut.VivoSRGB : SplendidGamut.sRGB, "Gamut: sRGB"); _modes.Add(isVivo ? SplendidGamut.VivoSRGB : SplendidGamut.sRGB, "Gamut: sRGB");
Logger.WriteLine(icm.FullName + " sRGB"); Logger.WriteLine(icm.FullName + " sRGB");
} }
catch catch
{ {
} }
} }
@@ -175,7 +177,8 @@ namespace GHelper.Display
{ SplendidCommand.FPS, "FPS"}, { SplendidCommand.FPS, "FPS"},
{ SplendidCommand.Cinema, "Cinema"}, { SplendidCommand.Cinema, "Cinema"},
{ SplendidCommand.Vivid, "Vivid" }, { SplendidCommand.Vivid, "Vivid" },
{ SplendidCommand.Eyecare, "Eyecare"} { SplendidCommand.Eyecare, "Eyecare"},
{ SplendidCommand.Disabled, "Disabled"}
}; };
} }
@@ -205,6 +208,20 @@ namespace GHelper.Display
}; };
} }
const string GameVisualKey = @"HKEY_CURRENT_USER\Software\ASUS\ARMOURY CRATE Service\GameVisual";
const string GameVisualValue = "ActiveGVStatus";
public static bool IsEnabled()
{
var status = (int?)Registry.GetValue(GameVisualKey, GameVisualValue, 1);
return status > 0;
}
public static void SetRegStatus(int status = 1)
{
Registry.SetValue(GameVisualKey, GameVisualValue, status, RegistryValueKind.DWord);
}
public static void SetGamut(int mode = -1) public static void SetGamut(int mode = -1)
{ {
if (skipGamut) return; if (skipGamut) return;
@@ -235,7 +252,7 @@ namespace GHelper.Display
public static void SetVisual(SplendidCommand mode = SplendidCommand.Default, int whiteBalance = DefaultColorTemp, bool init = false) public static void SetVisual(SplendidCommand mode = SplendidCommand.Default, int whiteBalance = DefaultColorTemp, bool init = false)
{ {
if (mode == SplendidCommand.None) return; if (mode == SplendidCommand.None) return;
if ((mode == SplendidCommand.Default || mode == SplendidCommand.VivoNormal) && init) return; // Skip default setting on init if ((mode == SplendidCommand.Disabled || mode == SplendidCommand.Default || mode == SplendidCommand.VivoNormal) && init) return; // Skip default setting on init
if (!forceVisual && ScreenCCD.GetHDRStatus(true)) return; if (!forceVisual && ScreenCCD.GetHDRStatus(true)) return;
if (!forceVisual && ScreenNative.GetRefreshRate(ScreenNative.FindLaptopScreen(true)) < 0) return; if (!forceVisual && ScreenNative.GetRefreshRate(ScreenNative.FindLaptopScreen(true)) < 0) return;
@@ -245,12 +262,16 @@ namespace GHelper.Display
if (whiteBalance != DefaultColorTemp && !init) ProcessHelper.RunAsAdmin(); if (whiteBalance != DefaultColorTemp && !init) ProcessHelper.RunAsAdmin();
int? balance; int? balance = null;
int command = 0;
switch (mode) switch (mode)
{ {
case SplendidCommand.Disabled:
command = 2;
break;
case SplendidCommand.Eyecare: case SplendidCommand.Eyecare:
balance = 2; balance = 4;
break; break;
case SplendidCommand.VivoNormal: case SplendidCommand.VivoNormal:
case SplendidCommand.VivoVivid: case SplendidCommand.VivoVivid:
@@ -264,7 +285,7 @@ namespace GHelper.Display
break; break;
} }
var result = RunSplendid(mode, 0, balance); int result = RunSplendid(mode, command, balance);
if (result == 0) return; if (result == 0) return;
if (result == -1) if (result == -1)
{ {
@@ -321,6 +342,11 @@ namespace GHelper.Display
var result = ProcessHelper.RunCMD(splendid, (int)command + " " + param1 + " " + param2); var result = ProcessHelper.RunCMD(splendid, (int)command + " " + param1 + " " + param2);
if (result.Contains("file not exist") || (result.Length == 0 && !isVivo)) return 1; if (result.Contains("file not exist") || (result.Length == 0 && !isVivo)) return 1;
if (result.Contains("return code: -1")) return -1; if (result.Contains("return code: -1")) return -1;
if (result.Contains("Visual is disabled"))
{
SetRegStatus(1);
return 1;
}
} }
return 0; return 0;

View File

@@ -15,7 +15,7 @@
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly> <ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyVersion>0.195</AssemblyVersion> <AssemblyVersion>0.198</AssemblyVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@@ -24,7 +24,7 @@ public static class HardwareControl
public static decimal? fullCapacity; public static decimal? fullCapacity;
public static decimal? chargeCapacity; public static decimal? chargeCapacity;
public static string? batteryCharge;
public static string? cpuFan; public static string? cpuFan;
public static string? gpuFan; public static string? gpuFan;
@@ -34,6 +34,20 @@ public static class HardwareControl
static long lastUpdate; static long lastUpdate;
static bool _chargeWatt = AppConfig.Is("charge_watt");
public static bool chargeWatt
{
get
{
return _chargeWatt;
}
set
{
AppConfig.Set("charge_watt", value ? 1 : 0);
_chargeWatt = value;
}
}
private static int GetGpuUse() private static int GetGpuUse()
{ {
try try
@@ -226,11 +240,17 @@ public static class HardwareControl
if (fullCapacity > 0 && chargeCapacity > 0) if (fullCapacity > 0 && chargeCapacity > 0)
{ {
batteryCapacity = Math.Min(100, ((decimal)chargeCapacity / (decimal)fullCapacity) * 100); batteryCapacity = Math.Min(100, (decimal)chargeCapacity / (decimal)fullCapacity * 100);
if (batteryCapacity > 99) BatteryControl.UnSetBatteryLimitFull(); if (batteryCapacity > 99 && BatteryControl.chargeFull) BatteryControl.UnSetBatteryLimitFull();
if (chargeWatt)
{
batteryCharge = Math.Round((decimal)chargeCapacity / 1000, 1).ToString() + "Wh";
}
else
{
batteryCharge = Math.Round(batteryCapacity, 1) + "%";
}
} }
} }
public static bool IsUsedGPU(int threshold = 10) public static bool IsUsedGPU(int threshold = 10)

View File

@@ -106,7 +106,7 @@ public class Startup
{ {
td.RegistrationInfo.Description = "G-Helper Auto Start"; td.RegistrationInfo.Description = "G-Helper Auto Start";
td.Triggers.Add(new LogonTrigger { UserId = WindowsIdentity.GetCurrent().Name, Delay = TimeSpan.FromSeconds(1) }); td.Triggers.Add(new LogonTrigger { UserId = WindowsIdentity.GetCurrent().Name, Delay = TimeSpan.FromSeconds(2) });
td.Actions.Add(strExeFilePath); td.Actions.Add(strExeFilePath);
if (ProcessHelper.IsUserAdministrator()) if (ProcessHelper.IsUserAdministrator())

View File

@@ -14,9 +14,16 @@ namespace GHelper.Input
{ {
System.Timers.Timer timer = new System.Timers.Timer(1000); System.Timers.Timer timer = new System.Timers.Timer(1000);
public static bool backlightActivity = true; public static bool backlightActivity = true;
public static bool lidClose = false;
public static Keys keyProfile = Keys.F5; public static Keys keyProfile = (Keys)AppConfig.Get("keybind_profile", (int)Keys.F5);
public static Keys keyApp = Keys.F12; public static Keys keyApp = (Keys)AppConfig.Get("keybind_app", (int)Keys.F12);
public static Keys keyProfile0 = (Keys)AppConfig.Get("keybind_profile_0", (int)Keys.F17);
public static Keys keyProfile1 = (Keys)AppConfig.Get("keybind_profile_1", (int)Keys.F18);
public static Keys keyProfile2 = (Keys)AppConfig.Get("keybind_profile_2", (int)Keys.F16);
public static Keys keyProfile3 = (Keys)AppConfig.Get("keybind_profile_3", (int)Keys.F19);
public static Keys keyProfile4 = (Keys)AppConfig.Get("keybind_profile_4", (int)Keys.F20);
static ModeControl modeControl = Program.modeControl; static ModeControl modeControl = Program.modeControl;
static ScreenControl screenControl = new ScreenControl(); static ScreenControl screenControl = new ScreenControl();
@@ -101,10 +108,6 @@ namespace GHelper.Input
{ {
hook.UnregisterAll(); hook.UnregisterAll();
// CTRL + SHIFT + F5 to cycle profiles
if (AppConfig.Get("keybind_profile") != -1) keyProfile = (Keys)AppConfig.Get("keybind_profile");
if (AppConfig.Get("keybind_app") != -1) keyApp = (Keys)AppConfig.Get("keybind_app");
string actionM1 = AppConfig.GetString("m1"); string actionM1 = AppConfig.GetString("m1");
string actionM2 = AppConfig.GetString("m2"); string actionM2 = AppConfig.GetString("m2");
@@ -118,18 +121,22 @@ namespace GHelper.Input
if (!AppConfig.Is("skip_hotkeys")) if (!AppConfig.Is("skip_hotkeys"))
{ {
if (AppConfig.IsDUO())
{
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F7);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F8);
}
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F13); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F13);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F14); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F14);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F15); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F15);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F16); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, keyProfile0);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F17); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, keyProfile1);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F18); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, keyProfile2);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F19); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, keyProfile3);
hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, Keys.F20); hook.RegisterHotKey(ModifierKeys.Shift | ModifierKeys.Control | ModifierKeys.Alt, keyProfile4);
hook.RegisterHotKey(ModifierKeys.Control, Keys.VolumeDown); hook.RegisterHotKey(ModifierKeys.Control, Keys.VolumeDown);
hook.RegisterHotKey(ModifierKeys.Control, Keys.VolumeUp); hook.RegisterHotKey(ModifierKeys.Control, Keys.VolumeUp);
@@ -420,6 +427,12 @@ namespace GHelper.Input
if (e.Modifier == (ModifierKeys.Control | ModifierKeys.Shift | ModifierKeys.Alt)) if (e.Modifier == (ModifierKeys.Control | ModifierKeys.Shift | ModifierKeys.Alt))
{ {
if (e.Key == keyProfile) modeControl.CyclePerformanceMode(true); if (e.Key == keyProfile) modeControl.CyclePerformanceMode(true);
if (e.Key == keyProfile0) modeControl.SetPerformanceMode(0, true);
if (e.Key == keyProfile1) modeControl.SetPerformanceMode(1, true);
if (e.Key == keyProfile2) modeControl.SetPerformanceMode(2, true);
if (e.Key == keyProfile3) modeControl.SetPerformanceMode(3, true);
if (e.Key == keyProfile4) modeControl.SetPerformanceMode(4, true);
switch (e.Key) switch (e.Key)
{ {
@@ -435,30 +448,23 @@ namespace GHelper.Input
case Keys.F4: case Keys.F4:
Program.settingsForm.BeginInvoke(Program.settingsForm.allyControl.ToggleModeHotkey); Program.settingsForm.BeginInvoke(Program.settingsForm.allyControl.ToggleModeHotkey);
break; break;
case Keys.F7:
SetScreenpad(-10);
break;
case Keys.F8:
SetScreenpad(10);
break;
case Keys.F13: case Keys.F13:
ToggleScreenRate(); ToggleScreenRate();
break; break;
case Keys.F14: case Keys.F14:
Program.toast.RunToast(Properties.Strings.EcoMode);
Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeEco); Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeEco);
break; break;
case Keys.F15: case Keys.F15:
Program.toast.RunToast(Properties.Strings.StandardMode);
Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeStandard); Program.settingsForm.gpuControl.SetGPUMode(AsusACPI.GPUModeStandard);
break; break;
case Keys.F16:
modeControl.SetPerformanceMode(2, true);
break;
case Keys.F17:
modeControl.SetPerformanceMode(0, true);
break;
case Keys.F18:
modeControl.SetPerformanceMode(1, true);
break;
case Keys.F19:
modeControl.SetPerformanceMode(3, true);
break;
case Keys.F20:
modeControl.SetPerformanceMode(4, true);
break;
} }
} }
@@ -735,6 +741,8 @@ namespace GHelper.Input
KeyProcess("fne"); KeyProcess("fne");
return; return;
case 174: // FN+F5 case 174: // FN+F5
case 153: // FN+F5 OLD MODELS
case 157: // Zenbook DUO FN+F
modeControl.CyclePerformanceMode(Control.ModifierKeys == Keys.Shift); modeControl.CyclePerformanceMode(Control.ModifierKeys == Keys.Shift);
return; return;
case 179: // FN+F4 case 179: // FN+F4
@@ -867,6 +875,7 @@ namespace GHelper.Input
public static void SetBacklightAuto(bool init = false) public static void SetBacklightAuto(bool init = false)
{ {
if (lidClose) return;
if (init) Aura.Init(); if (init) Aura.Init();
Aura.ApplyBrightness(GetBacklight(), "Auto", init); Aura.ApplyBrightness(GetBacklight(), "Auto", init);
} }
@@ -1012,6 +1021,13 @@ namespace GHelper.Input
Program.toast.RunToast($"Screen Pad {toast}", delta > 0 ? ToastIcon.BrightnessUp : ToastIcon.BrightnessDown); Program.toast.RunToast($"Screen Pad {toast}", delta > 0 ? ToastIcon.BrightnessUp : ToastIcon.BrightnessDown);
} }
public static void InitScreenpad()
{
if (!AppConfig.IsDUO()) return;
int brightness = AppConfig.Get("screenpad");
if (brightness >= 0) ApplyScreenpadAction(brightness);
}
static void LaunchProcess(string command = "") static void LaunchProcess(string command = "")
{ {
if (string.IsNullOrEmpty(command)) return; if (string.IsNullOrEmpty(command)) return;

View File

@@ -10,6 +10,8 @@ namespace GHelper.Input
CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
Action<int> _handler; Action<int> _handler;
static int retry = 0;
public KeyboardListener(Action<int> KeyHandler) public KeyboardListener(Action<int> KeyHandler)
{ {
_handler = KeyHandler; _handler = KeyHandler;
@@ -67,6 +69,12 @@ namespace GHelper.Input
catch (Exception ex) catch (Exception ex)
{ {
Logger.WriteLine($"Listener exited: {ex.Message}"); Logger.WriteLine($"Listener exited: {ex.Message}");
if (retry++ < 2)
{
Thread.Sleep(300);
Logger.WriteLine($"Restarting listener {retry}");
Listen();
}
} }
} }

View File

@@ -81,7 +81,7 @@ namespace GHelper
{ {
AppConfig.Set("matrix_contrast", trackContrast.Value); AppConfig.Set("matrix_contrast", trackContrast.Value);
AppConfig.Set("matrix_gamma", trackGamma.Value); AppConfig.Set("matrix_gamma", trackGamma.Value);
SetMatrixPicture(); SetMatrixPicture(false);
} }

View File

@@ -110,30 +110,24 @@ namespace GHelper.Mode
if (notify) Toast(); if (notify) Toast();
// Power plan from config or defaulting to balanced if (!AppConfig.Is("skip_powermode"))
if (AppConfig.GetModeString("scheme") is not null) {
PowerNative.SetPowerPlan(AppConfig.GetModeString("scheme")); // Power plan from config or defaulting to balanced
else if (AppConfig.GetModeString("scheme") is not null)
PowerNative.SetBalancedPowerPlan(); PowerNative.SetPowerPlan(AppConfig.GetModeString("scheme"));
else
PowerNative.SetBalancedPowerPlan();
// Windows power mode // Windows power mode
if (AppConfig.GetModeString("powermode") is not null) if (AppConfig.GetModeString("powermode") is not null)
PowerNative.SetPowerMode(AppConfig.GetModeString("powermode")); PowerNative.SetPowerMode(AppConfig.GetModeString("powermode"));
else else
PowerNative.SetPowerMode(Modes.GetBase(mode)); PowerNative.SetPowerMode(Modes.GetBase(mode));
}
// CPU Boost setting override // CPU Boost setting override
if (AppConfig.GetMode("auto_boost") != -1) if (AppConfig.GetMode("auto_boost") != -1)
PowerNative.SetCPUBoost(AppConfig.GetMode("auto_boost")); PowerNative.SetCPUBoost(AppConfig.GetMode("auto_boost"));
//BatteryControl.SetBatteryChargeLimit();
/*
if (NativeMethods.PowerGetEffectiveOverlayScheme(out Guid activeScheme) == 0)
{
Debug.WriteLine("Effective :" + activeScheme);
}
*/
settings.FansInit(); settings.FansInit();
} }
@@ -162,7 +156,8 @@ namespace GHelper.Mode
modeToggleTimer.Start(); modeToggleTimer.Start();
Modes.SetCurrent(Modes.GetNext(back)); Modes.SetCurrent(Modes.GetNext(back));
Toast(); Toast();
} else }
else
{ {
SetPerformanceMode(Modes.GetNext(back), true); SetPerformanceMode(Modes.GetNext(back), true);
} }
@@ -385,7 +380,7 @@ namespace GHelper.Mode
if (gpu_power >= AsusACPI.MinGPUPower && gpu_power <= AsusACPI.MaxGPUPower && Program.acpi.DeviceGet(AsusACPI.GPU_POWER) >= 0) if (gpu_power >= AsusACPI.MinGPUPower && gpu_power <= AsusACPI.MaxGPUPower && Program.acpi.DeviceGet(AsusACPI.GPU_POWER) >= 0)
Program.acpi.DeviceSet(AsusACPI.GPU_POWER, gpu_power, "PowerLimit TGP (GPU VAR)"); Program.acpi.DeviceSet(AsusACPI.GPU_POWER, gpu_power, "PowerLimit TGP (GPU VAR)");
if (gpu_boost >= AsusACPI.MinGPUBoost && gpu_boost <= AsusACPI.MaxGPUBoost && Program.acpi.DeviceGet(AsusACPI.PPT_GPUC0) >= 0) if (gpu_boost >= AsusACPI.MinGPUBoost && gpu_boost <= AsusACPI.MaxGPUBoost && Program.acpi.DeviceGet(AsusACPI.PPT_GPUC0) >= 0)
boostResult = Program.acpi.DeviceSet(AsusACPI.PPT_GPUC0, gpu_boost, "PowerLimit C0 (GPU BOOST)"); boostResult = Program.acpi.DeviceSet(AsusACPI.PPT_GPUC0, gpu_boost, "PowerLimit C0 (GPU BOOST)");
if (gpu_temp >= AsusACPI.MinGPUTemp && gpu_temp <= AsusACPI.MaxGPUTemp && Program.acpi.DeviceGet(AsusACPI.PPT_GPUC2) >= 0) if (gpu_temp >= AsusACPI.MinGPUTemp && gpu_temp <= AsusACPI.MaxGPUTemp && Program.acpi.DeviceGet(AsusACPI.PPT_GPUC2) >= 0)

View File

@@ -231,7 +231,12 @@ namespace GHelper
Logger.WriteLine("AutoSetting for " + isPlugged.ToString()); Logger.WriteLine("AutoSetting for " + isPlugged.ToString());
BatteryControl.AutoBattery(init); BatteryControl.AutoBattery(init);
if (init) screenControl.InitMiniled();
if (init)
{
screenControl.InitMiniled();
InputDispatcher.InitScreenpad();
}
inputDispatcher.Init(); inputDispatcher.Init();

View File

@@ -235,6 +235,7 @@ namespace GHelper
labelCharge.MouseEnter += PanelBattery_MouseEnter; labelCharge.MouseEnter += PanelBattery_MouseEnter;
labelCharge.MouseLeave += PanelBattery_MouseLeave; labelCharge.MouseLeave += PanelBattery_MouseLeave;
labelBattery.Click += LabelBattery_Click;
buttonPeripheral1.Click += ButtonPeripheral_Click; buttonPeripheral1.Click += ButtonPeripheral_Click;
buttonPeripheral2.Click += ButtonPeripheral_Click; buttonPeripheral2.Click += ButtonPeripheral_Click;
@@ -284,6 +285,12 @@ namespace GHelper
InitVisual(); InitVisual();
} }
private void LabelBattery_Click(object? sender, EventArgs e)
{
HardwareControl.chargeWatt = !HardwareControl.chargeWatt;
RefreshSensors(true);
}
private void ButtonDonate_Click(object? sender, EventArgs e) private void ButtonDonate_Click(object? sender, EventArgs e)
{ {
AppConfig.Set("donate_click", 1); AppConfig.Set("donate_click", 1);
@@ -667,14 +674,14 @@ namespace GHelper
{ {
case 0: case 0:
Logger.WriteLine("Lid Closed"); Logger.WriteLine("Lid Closed");
InputDispatcher.lidClose = AniMatrixControl.lidClose = true;
Aura.ApplyBrightness(0, "Lid"); Aura.ApplyBrightness(0, "Lid");
AniMatrixControl.lidClose = true;
matrixControl.SetLidMode(); matrixControl.SetLidMode();
break; break;
case 1: case 1:
Logger.WriteLine("Lid Open"); Logger.WriteLine("Lid Open");
InputDispatcher.lidClose = AniMatrixControl.lidClose = false;
Aura.ApplyBrightness(InputDispatcher.GetBacklight(), "Lid"); Aura.ApplyBrightness(InputDispatcher.GetBacklight(), "Lid");
AniMatrixControl.lidClose = false;
matrixControl.SetLidMode(); matrixControl.SetLidMode();
break; break;
} }
@@ -843,7 +850,7 @@ namespace GHelper
private void Button60Hz_MouseHover(object? sender, EventArgs e) private void Button60Hz_MouseHover(object? sender, EventArgs e)
{ {
labelTipScreen.Text = Properties.Strings.MinRefreshTooltip; labelTipScreen.Text = Properties.Strings.MinRefreshTooltip.Replace("60", ScreenControl.MIN_RATE.ToString());
} }
private void ButtonScreen_MouseLeave(object? sender, EventArgs e) private void ButtonScreen_MouseLeave(object? sender, EventArgs e)
@@ -853,7 +860,7 @@ namespace GHelper
private void ButtonScreenAuto_MouseHover(object? sender, EventArgs e) private void ButtonScreenAuto_MouseHover(object? sender, EventArgs e)
{ {
labelTipScreen.Text = Properties.Strings.AutoRefreshTooltip; labelTipScreen.Text = Properties.Strings.AutoRefreshTooltip.Replace("60", ScreenControl.MIN_RATE.ToString());
} }
private void ButtonUltimate_MouseHover(object? sender, EventArgs e) private void ButtonUltimate_MouseHover(object? sender, EventArgs e)
@@ -1208,7 +1215,7 @@ namespace GHelper
private void Button60Hz_Click(object? sender, EventArgs e) private void Button60Hz_Click(object? sender, EventArgs e)
{ {
AppConfig.Set("screen_auto", 0); AppConfig.Set("screen_auto", 0);
screenControl.SetScreen(60, 0); screenControl.SetScreen(ScreenControl.MIN_RATE, 0);
} }
@@ -1239,16 +1246,18 @@ namespace GHelper
{ {
buttonScreenAuto.Activated = true; buttonScreenAuto.Activated = true;
} }
else if (frequency == 60) else if (frequency == ScreenControl.MIN_RATE)
{ {
button60Hz.Activated = true; button60Hz.Activated = true;
} }
else if (frequency > 60) else if (frequency > ScreenControl.MIN_RATE)
{ {
button120Hz.Activated = true; button120Hz.Activated = true;
} }
if (maxFrequency > 60) button60Hz.Text = ScreenControl.MIN_RATE + "Hz";
if (maxFrequency > ScreenControl.MIN_RATE)
{ {
button120Hz.Text = maxFrequency.ToString() + "Hz" + (overdriveSetting ? " + OD" : ""); button120Hz.Text = maxFrequency.ToString() + "Hz" + (overdriveSetting ? " + OD" : "");
panelScreen.Visible = true; panelScreen.Visible = true;
@@ -1420,7 +1429,9 @@ namespace GHelper
cpuTemp = ": " + Math.Round((decimal)HardwareControl.cpuTemp).ToString() + "°C"; cpuTemp = ": " + Math.Round((decimal)HardwareControl.cpuTemp).ToString() + "°C";
if (HardwareControl.batteryCapacity > 0) if (HardwareControl.batteryCapacity > 0)
charge = Properties.Strings.BatteryCharge + ": " + Math.Round(HardwareControl.batteryCapacity, 1) + "% "; {
charge = Properties.Strings.BatteryCharge + ": " + HardwareControl.batteryCharge;
}
if (HardwareControl.batteryRate < 0) if (HardwareControl.batteryRate < 0)
battery = Properties.Strings.Discharging + ": " + Math.Round(-(decimal)HardwareControl.batteryRate, 1).ToString() + "W"; battery = Properties.Strings.Discharging + ": " + Math.Round(-(decimal)HardwareControl.batteryRate, 1).ToString() + "W";
@@ -1533,14 +1544,14 @@ namespace GHelper
public void AutoKeyboard() public void AutoKeyboard()
{ {
InputDispatcher.SetBacklightAuto(true);
if (!AppConfig.Is("skip_aura")) if (!AppConfig.Is("skip_aura"))
{ {
Aura.ApplyPower(); Aura.ApplyPower();
Aura.ApplyAura(); Aura.ApplyAura();
} }
InputDispatcher.SetBacklightAuto(true);
if (Program.acpi.IsXGConnected()) if (Program.acpi.IsXGConnected())
XGM.Light(AppConfig.Is("xmg_light")); XGM.Light(AppConfig.Is("xmg_light"));
@@ -1775,7 +1786,7 @@ namespace GHelper
public void VisualiseBatteryFull() public void VisualiseBatteryFull()
{ {
if (AppConfig.Is("charge_full")) if (BatteryControl.chargeFull)
{ {
buttonBatteryFull.BackColor = colorStandard; buttonBatteryFull.BackColor = colorStandard;
buttonBatteryFull.ForeColor = SystemColors.ControlLightLight; buttonBatteryFull.ForeColor = SystemColors.ControlLightLight;