mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
10 Commits
v0.9
...
notificati
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc1f3ab530 | ||
|
|
3cd62bc9e1 | ||
|
|
16f6f3f934 | ||
|
|
1f4afedc1d | ||
|
|
c705ce2b5b | ||
|
|
75942ebdb2 | ||
|
|
6d142213c8 | ||
|
|
bfcb97b158 | ||
|
|
f97765c5c2 | ||
|
|
19a8b0dc22 |
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net7.0-windows8.0</TargetFramework>
|
||||
<TargetFramework>net7.0-windows10.0.17763.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>True</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="hidlibrary" Version="3.3.40" />
|
||||
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
|
||||
<PackageReference Include="LibreHardwareMonitorLib" Version="0.9.1" />
|
||||
<PackageReference Include="System.Management" Version="7.0.0" />
|
||||
<PackageReference Include="TaskScheduler" Version="2.10.1" />
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using HidLibrary;
|
||||
using LibreHardwareMonitor.Hardware;
|
||||
using Microsoft.Win32.TaskScheduler;
|
||||
using System.Diagnostics;
|
||||
using System.Management;
|
||||
using System.Runtime.InteropServices;
|
||||
using HidLibrary;
|
||||
using System.Text.Json;
|
||||
using LibreHardwareMonitor.Hardware;
|
||||
using System.Threading;
|
||||
|
||||
public class ASUSWmi
|
||||
{
|
||||
@@ -232,7 +231,7 @@ public class NativeMethods
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid SubGroupOfPowerSettingsGuid,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid PowerSettingGuid,
|
||||
int AcValueIndex);
|
||||
|
||||
|
||||
[DllImport("PowrProf.dll", CharSet = CharSet.Unicode)]
|
||||
static extern UInt32 PowerReadACValueIndex(IntPtr RootPowerKey,
|
||||
[MarshalAs(UnmanagedType.LPStruct)] Guid SchemeGuid,
|
||||
@@ -550,7 +549,7 @@ public class HardwareMonitor
|
||||
|
||||
public void ReadSensors()
|
||||
{
|
||||
|
||||
|
||||
computer.Open();
|
||||
computer.Accept(new UpdateVisitor());
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# G14-Helper
|
||||
# G-Helper (For G14, G15, ROG FLOW, and others)
|
||||
|
||||
A tiny system tray utility that allows you set performance and GPU profiles for your laptop. Same as ASUS Armory Crate does but without it completely!.
|
||||
|
||||
@@ -29,6 +29,7 @@ Profiles are **same** as in Armory Crate, including default fan curves
|
||||
5. FN+F5 an M4 (Rog) keys cycle through Performance modes
|
||||
6. Screen resolution and display overdrive switching
|
||||
7. CPU turbo boost switching
|
||||
8. CPU & dGPU temperature monitoring in Celsius, battery charge / discharge rates in Watts
|
||||
|
||||
## Things still missing
|
||||
|
||||
|
||||
5
Settings.Designer.cs
generated
5
Settings.Designer.cs
generated
@@ -473,6 +473,7 @@
|
||||
"Strobe",
|
||||
"Rainbow"});
|
||||
this.comboKeyboard.Location = new System.Drawing.Point(38, 778);
|
||||
this.comboKeyboard.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.comboKeyboard.Name = "comboKeyboard";
|
||||
this.comboKeyboard.Size = new System.Drawing.Size(200, 40);
|
||||
this.comboKeyboard.TabIndex = 24;
|
||||
@@ -482,7 +483,7 @@
|
||||
//
|
||||
this.buttonKeyboardColor.BackColor = System.Drawing.SystemColors.ButtonHighlight;
|
||||
this.buttonKeyboardColor.FlatAppearance.BorderColor = System.Drawing.Color.Red;
|
||||
this.buttonKeyboardColor.FlatAppearance.BorderSize = 4;
|
||||
this.buttonKeyboardColor.FlatAppearance.BorderSize = 3;
|
||||
this.buttonKeyboardColor.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.buttonKeyboardColor.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this.buttonKeyboardColor.Location = new System.Drawing.Point(261, 773);
|
||||
@@ -517,7 +518,7 @@
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(13F, 32F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(744, 1085);
|
||||
this.ClientSize = new System.Drawing.Size(744, 1093);
|
||||
this.Controls.Add(this.labelBattery);
|
||||
this.Controls.Add(this.buttonKeyboardColor);
|
||||
this.Controls.Add(this.comboKeyboard);
|
||||
|
||||
51
Settings.cs
51
Settings.cs
@@ -1,5 +1,8 @@
|
||||
using System.Diagnostics;
|
||||
using System.Timers;
|
||||
using System.Windows.Forms;
|
||||
using Windows.UI.Notifications;
|
||||
using Microsoft.Toolkit.Uwp.Notifications;
|
||||
|
||||
namespace GHelper
|
||||
{
|
||||
@@ -294,12 +297,13 @@ namespace GHelper
|
||||
|
||||
private static void SetTimer()
|
||||
{
|
||||
aTimer = new System.Timers.Timer(1000);
|
||||
aTimer = new System.Timers.Timer(500);
|
||||
aTimer.Elapsed += OnTimedEvent;
|
||||
aTimer.AutoReset = true;
|
||||
aTimer.Enabled = false;
|
||||
}
|
||||
|
||||
private static void OnTimedEvent(Object? source, ElapsedEventArgs? e)
|
||||
private static void RefreshSensors()
|
||||
{
|
||||
string cpuFan = " Fan: " + Math.Round(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan) / 0.6).ToString() + "%";
|
||||
string gpuFan = " Fan: " + Math.Round(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan) / 0.6) + "%";
|
||||
@@ -311,7 +315,8 @@ namespace GHelper
|
||||
try
|
||||
{
|
||||
Program.hwmonitor.ReadSensors();
|
||||
} catch
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.WriteLine("Failed reading sensors");
|
||||
}
|
||||
@@ -334,7 +339,12 @@ namespace GHelper
|
||||
Program.settingsForm.labelGPUFan.Text = "GPU" + gpuTemp + gpuFan;
|
||||
Program.settingsForm.labelBattery.Text = battery;
|
||||
});
|
||||
}
|
||||
|
||||
private static void OnTimedEvent(Object? source, ElapsedEventArgs? e)
|
||||
{
|
||||
RefreshSensors();
|
||||
aTimer.Interval = 2000;
|
||||
}
|
||||
|
||||
private void SettingsForm_VisibleChanged(object? sender, EventArgs e)
|
||||
@@ -346,6 +356,8 @@ namespace GHelper
|
||||
this.Left = Screen.FromControl(this).Bounds.Width - 10 - this.Width;
|
||||
this.Top = Screen.FromControl(this).WorkingArea.Height - 10 - this.Height;
|
||||
this.Activate();
|
||||
|
||||
aTimer.Interval = 500;
|
||||
aTimer.Enabled = true;
|
||||
|
||||
}
|
||||
@@ -365,6 +377,12 @@ namespace GHelper
|
||||
buttonBalanced.FlatAppearance.BorderSize = buttonInactive;
|
||||
buttonTurbo.FlatAppearance.BorderSize = buttonInactive;
|
||||
|
||||
string[] mode = new string[]{
|
||||
"Balanced",
|
||||
"Turbo",
|
||||
"Silent"
|
||||
};
|
||||
|
||||
switch (PerformanceMode)
|
||||
{
|
||||
case ASUSWmi.PerformanceSilent:
|
||||
@@ -382,24 +400,45 @@ namespace GHelper
|
||||
break;
|
||||
}
|
||||
|
||||
string notifTitle = "Performance Mode Changed";
|
||||
string notifBody = "Switched to: " + mode[PerformanceMode];
|
||||
Program.config.setConfig("performance_mode", PerformanceMode);
|
||||
try
|
||||
{
|
||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, PerformanceMode);
|
||||
}
|
||||
catch
|
||||
} catch
|
||||
{
|
||||
labelPerf.Text = "Performance Mode: not supported";
|
||||
}
|
||||
|
||||
if(notify)
|
||||
sendNotification(notifTitle, notifBody);
|
||||
}
|
||||
|
||||
|
||||
public void CyclePerformanceMode()
|
||||
{
|
||||
SetPerformanceMode(Program.config.getConfig("performance_mode") + 1);
|
||||
SetPerformanceMode(Program.config.getConfig("performance_mode") + 1, true);
|
||||
}
|
||||
|
||||
|
||||
public void sendNotification(string title, string message)
|
||||
{
|
||||
var content = new ToastContentBuilder()
|
||||
.AddText(title)
|
||||
.AddText(message)
|
||||
.SetToastDuration(ToastDuration.Short)
|
||||
.GetToastContent();
|
||||
|
||||
var notification = new ToastNotification(content.GetXml())
|
||||
{
|
||||
Priority = ToastNotificationPriority.High
|
||||
};
|
||||
|
||||
ToastNotificationManagerCompat.CreateToastNotifier().Show(notification);
|
||||
}
|
||||
|
||||
|
||||
public void AutoScreen(int Plugged = 1)
|
||||
{
|
||||
int ScreenAuto = Program.config.getConfig("screen_auto");
|
||||
|
||||
Reference in New Issue
Block a user