mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
UI Tweaks
This commit is contained in:
@@ -49,6 +49,7 @@ namespace GHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class AsusUSB
|
public static class AsusUSB
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -75,6 +76,7 @@ namespace GHelper
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Dictionary<int, string> _modes = new Dictionary<int, string>
|
static Dictionary<int, string> _modes = new Dictionary<int, string>
|
||||||
{
|
{
|
||||||
{ 0, Properties.Strings.AuraStatic },
|
{ 0, Properties.Strings.AuraStatic },
|
||||||
|
|||||||
53
app/Fans.Designer.cs
generated
53
app/Fans.Designer.cs
generated
@@ -31,14 +31,14 @@ namespace GHelper
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
ChartArea chartArea1 = new ChartArea();
|
ChartArea chartArea9 = new ChartArea();
|
||||||
Title title1 = new Title();
|
Title title9 = new Title();
|
||||||
ChartArea chartArea2 = new ChartArea();
|
ChartArea chartArea10 = new ChartArea();
|
||||||
Title title2 = new Title();
|
Title title10 = new Title();
|
||||||
ChartArea chartArea3 = new ChartArea();
|
ChartArea chartArea11 = new ChartArea();
|
||||||
Title title3 = new Title();
|
Title title11 = new Title();
|
||||||
ChartArea chartArea4 = new ChartArea();
|
ChartArea chartArea12 = new ChartArea();
|
||||||
Title title4 = new Title();
|
Title title12 = new Title();
|
||||||
panelFans = new Panel();
|
panelFans = new Panel();
|
||||||
labelTip = new Label();
|
labelTip = new Label();
|
||||||
tableFanCharts = new TableLayoutPanel();
|
tableFanCharts = new TableLayoutPanel();
|
||||||
@@ -154,7 +154,6 @@ namespace GHelper
|
|||||||
// tableFanCharts
|
// tableFanCharts
|
||||||
//
|
//
|
||||||
tableFanCharts.AutoSize = true;
|
tableFanCharts.AutoSize = true;
|
||||||
tableFanCharts.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
|
||||||
tableFanCharts.ColumnCount = 1;
|
tableFanCharts.ColumnCount = 1;
|
||||||
tableFanCharts.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
|
tableFanCharts.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
|
||||||
tableFanCharts.Controls.Add(chartGPU, 0, 1);
|
tableFanCharts.Controls.Add(chartGPU, 0, 1);
|
||||||
@@ -176,8 +175,8 @@ namespace GHelper
|
|||||||
//
|
//
|
||||||
// chartGPU
|
// chartGPU
|
||||||
//
|
//
|
||||||
chartArea1.Name = "ChartArea1";
|
chartArea9.Name = "ChartArea1";
|
||||||
chartGPU.ChartAreas.Add(chartArea1);
|
chartGPU.ChartAreas.Add(chartArea9);
|
||||||
chartGPU.Dock = DockStyle.Fill;
|
chartGPU.Dock = DockStyle.Fill;
|
||||||
chartGPU.Location = new Point(12, 259);
|
chartGPU.Location = new Point(12, 259);
|
||||||
chartGPU.Margin = new Padding(2, 10, 2, 10);
|
chartGPU.Margin = new Padding(2, 10, 2, 10);
|
||||||
@@ -185,13 +184,13 @@ namespace GHelper
|
|||||||
chartGPU.Size = new Size(781, 229);
|
chartGPU.Size = new Size(781, 229);
|
||||||
chartGPU.TabIndex = 17;
|
chartGPU.TabIndex = 17;
|
||||||
chartGPU.Text = "chartGPU";
|
chartGPU.Text = "chartGPU";
|
||||||
title1.Name = "Title1";
|
title9.Name = "Title1";
|
||||||
chartGPU.Titles.Add(title1);
|
chartGPU.Titles.Add(title9);
|
||||||
//
|
//
|
||||||
// chartCPU
|
// chartCPU
|
||||||
//
|
//
|
||||||
chartArea2.Name = "ChartArea1";
|
chartArea10.Name = "ChartArea1";
|
||||||
chartCPU.ChartAreas.Add(chartArea2);
|
chartCPU.ChartAreas.Add(chartArea10);
|
||||||
chartCPU.Dock = DockStyle.Fill;
|
chartCPU.Dock = DockStyle.Fill;
|
||||||
chartCPU.Location = new Point(12, 10);
|
chartCPU.Location = new Point(12, 10);
|
||||||
chartCPU.Margin = new Padding(2, 10, 2, 10);
|
chartCPU.Margin = new Padding(2, 10, 2, 10);
|
||||||
@@ -199,13 +198,13 @@ namespace GHelper
|
|||||||
chartCPU.Size = new Size(781, 229);
|
chartCPU.Size = new Size(781, 229);
|
||||||
chartCPU.TabIndex = 14;
|
chartCPU.TabIndex = 14;
|
||||||
chartCPU.Text = "chartCPU";
|
chartCPU.Text = "chartCPU";
|
||||||
title2.Name = "Title1";
|
title10.Name = "Title1";
|
||||||
chartCPU.Titles.Add(title2);
|
chartCPU.Titles.Add(title10);
|
||||||
//
|
//
|
||||||
// chartXGM
|
// chartXGM
|
||||||
//
|
//
|
||||||
chartArea3.Name = "ChartAreaXGM";
|
chartArea11.Name = "ChartAreaXGM";
|
||||||
chartXGM.ChartAreas.Add(chartArea3);
|
chartXGM.ChartAreas.Add(chartArea11);
|
||||||
chartXGM.Dock = DockStyle.Fill;
|
chartXGM.Dock = DockStyle.Fill;
|
||||||
chartXGM.Location = new Point(12, 757);
|
chartXGM.Location = new Point(12, 757);
|
||||||
chartXGM.Margin = new Padding(2, 10, 2, 10);
|
chartXGM.Margin = new Padding(2, 10, 2, 10);
|
||||||
@@ -213,14 +212,14 @@ namespace GHelper
|
|||||||
chartXGM.Size = new Size(781, 230);
|
chartXGM.Size = new Size(781, 230);
|
||||||
chartXGM.TabIndex = 14;
|
chartXGM.TabIndex = 14;
|
||||||
chartXGM.Text = "chartXGM";
|
chartXGM.Text = "chartXGM";
|
||||||
title3.Name = "Title4";
|
title11.Name = "Title4";
|
||||||
chartXGM.Titles.Add(title3);
|
chartXGM.Titles.Add(title11);
|
||||||
chartXGM.Visible = false;
|
chartXGM.Visible = false;
|
||||||
//
|
//
|
||||||
// chartMid
|
// chartMid
|
||||||
//
|
//
|
||||||
chartArea4.Name = "ChartArea3";
|
chartArea12.Name = "ChartArea3";
|
||||||
chartMid.ChartAreas.Add(chartArea4);
|
chartMid.ChartAreas.Add(chartArea12);
|
||||||
chartMid.Dock = DockStyle.Fill;
|
chartMid.Dock = DockStyle.Fill;
|
||||||
chartMid.Location = new Point(12, 508);
|
chartMid.Location = new Point(12, 508);
|
||||||
chartMid.Margin = new Padding(2, 10, 2, 10);
|
chartMid.Margin = new Padding(2, 10, 2, 10);
|
||||||
@@ -228,8 +227,8 @@ namespace GHelper
|
|||||||
chartMid.Size = new Size(781, 229);
|
chartMid.Size = new Size(781, 229);
|
||||||
chartMid.TabIndex = 14;
|
chartMid.TabIndex = 14;
|
||||||
chartMid.Text = "chartMid";
|
chartMid.Text = "chartMid";
|
||||||
title4.Name = "Title3";
|
title12.Name = "Title3";
|
||||||
chartMid.Titles.Add(title4);
|
chartMid.Titles.Add(title12);
|
||||||
chartMid.Visible = false;
|
chartMid.Visible = false;
|
||||||
//
|
//
|
||||||
// panelTitleFans
|
// panelTitleFans
|
||||||
@@ -793,11 +792,11 @@ namespace GHelper
|
|||||||
MaximizeBox = false;
|
MaximizeBox = false;
|
||||||
MdiChildrenMinimizedAnchorBottom = false;
|
MdiChildrenMinimizedAnchorBottom = false;
|
||||||
MinimizeBox = false;
|
MinimizeBox = false;
|
||||||
MinimumSize = new Size(26, 1260);
|
MinimumSize = new Size(0, 1200);
|
||||||
Name = "Fans";
|
Name = "Fans";
|
||||||
ShowIcon = false;
|
ShowIcon = false;
|
||||||
ShowInTaskbar = false;
|
ShowInTaskbar = false;
|
||||||
StartPosition = FormStartPosition.CenterScreen;
|
StartPosition = FormStartPosition.Manual;
|
||||||
Text = "Fans and Power";
|
Text = "Fans and Power";
|
||||||
panelFans.ResumeLayout(false);
|
panelFans.ResumeLayout(false);
|
||||||
panelFans.PerformLayout();
|
panelFans.PerformLayout();
|
||||||
|
|||||||
18
app/Fans.cs
18
app/Fans.cs
@@ -16,6 +16,8 @@ namespace GHelper
|
|||||||
|
|
||||||
static int MinRPM, MaxRPM;
|
static int MinRPM, MaxRPM;
|
||||||
|
|
||||||
|
static bool powerVisible = true, gpuVisible = true;
|
||||||
|
|
||||||
const int fansMax = 100;
|
const int fansMax = 100;
|
||||||
|
|
||||||
NvidiaGpuControl? nvControl = null;
|
NvidiaGpuControl? nvControl = null;
|
||||||
@@ -144,13 +146,13 @@ namespace GHelper
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
panelGPU.Visible = false;
|
gpuVisible = panelGPU.Visible = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
panelGPU.Visible = true;
|
gpuVisible = panelGPU.Visible = true;
|
||||||
|
|
||||||
int gpu_boost = AppConfig.getConfigPerf("gpu_boost");
|
int gpu_boost = AppConfig.getConfigPerf("gpu_boost");
|
||||||
int gpu_temp = AppConfig.getConfigPerf("gpu_temp");
|
int gpu_temp = AppConfig.getConfigPerf("gpu_temp");
|
||||||
@@ -198,7 +200,7 @@ namespace GHelper
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.WriteLine(ex.ToString());
|
Logger.WriteLine(ex.ToString());
|
||||||
panelGPU.Visible = false;
|
gpuVisible = panelGPU.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -291,9 +293,9 @@ namespace GHelper
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Fans_Shown(object? sender, EventArgs e)
|
public void FormPosition()
|
||||||
{
|
{
|
||||||
panelSliders.Visible = panelGPU.Visible || panelPower.Visible;
|
panelSliders.Visible = gpuVisible || powerVisible;
|
||||||
|
|
||||||
if (Height > Program.settingsForm.Height)
|
if (Height > Program.settingsForm.Height)
|
||||||
{
|
{
|
||||||
@@ -307,7 +309,11 @@ namespace GHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
Left = Program.settingsForm.Left - Width - 5;
|
Left = Program.settingsForm.Left - Width - 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Fans_Shown(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
FormPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -394,7 +400,7 @@ namespace GHelper
|
|||||||
bool cpuBmode = (Program.acpi.DeviceGet(AsusACPI.PPT_CPUB0) >= 0); // 2022 model +
|
bool cpuBmode = (Program.acpi.DeviceGet(AsusACPI.PPT_CPUB0) >= 0); // 2022 model +
|
||||||
bool cpuAmode = (Program.acpi.DeviceGet(AsusACPI.PPT_TotalA0) >= 0); // 2021 model +
|
bool cpuAmode = (Program.acpi.DeviceGet(AsusACPI.PPT_TotalA0) >= 0); // 2021 model +
|
||||||
|
|
||||||
panelPower.Visible = cpuAmode;
|
powerVisible = panelPower.Visible = cpuAmode;
|
||||||
panelCPU.Visible = cpuBmode;
|
panelCPU.Visible = cpuBmode;
|
||||||
|
|
||||||
// Yes, that's stupid, but Total slider on 2021 model actually adjusts CPU PPT
|
// Yes, that's stupid, but Total slider on 2021 model actually adjusts CPU PPT
|
||||||
|
|||||||
@@ -163,29 +163,33 @@ namespace GHelper
|
|||||||
|
|
||||||
// Asus Optimization service Events
|
// Asus Optimization service Events
|
||||||
|
|
||||||
int brightness = AppConfig.getConfig("keyboard_brightness");
|
int backlight = AppConfig.getConfig("keyboard_brightness");
|
||||||
|
|
||||||
|
string[] backlightNames = new string[] { "Off", "Low", "Mid", "Max" };
|
||||||
|
|
||||||
|
int brightness;
|
||||||
|
|
||||||
switch (EventID)
|
switch (EventID)
|
||||||
{
|
{
|
||||||
case 197: // FN+F2
|
case 197: // FN+F2
|
||||||
brightness = Math.Max(0, brightness - 1);
|
backlight = Math.Max(0, backlight - 1);
|
||||||
AppConfig.setConfig("keyboard_brightness", brightness);
|
AppConfig.setConfig("keyboard_brightness", backlight);
|
||||||
AsusUSB.ApplyBrightness(brightness);
|
AsusUSB.ApplyBrightness(backlight);
|
||||||
Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, "Backlight", ToastIcon.BacklightDown);
|
Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, backlightNames[backlight], ToastIcon.BacklightDown);
|
||||||
break;
|
break;
|
||||||
case 196: // FN+F3
|
case 196: // FN+F3
|
||||||
brightness = Math.Min(3, brightness + 1);
|
backlight = Math.Min(3, backlight + 1);
|
||||||
AppConfig.setConfig("keyboard_brightness", brightness);
|
AppConfig.setConfig("keyboard_brightness", backlight);
|
||||||
AsusUSB.ApplyBrightness(brightness);
|
AsusUSB.ApplyBrightness(backlight);
|
||||||
Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, "Backlight", ToastIcon.BacklightUp);
|
Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, backlightNames[backlight], ToastIcon.BacklightUp);
|
||||||
break;
|
break;
|
||||||
case 16: // FN+F7
|
case 16: // FN+F7
|
||||||
ScreenBrightness.Adjust(-10);
|
brightness = ScreenBrightness.Adjust(-10);
|
||||||
Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, "Brightness", ToastIcon.BrightnessDown);
|
Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, brightness + "%", ToastIcon.BrightnessDown);
|
||||||
break;
|
break;
|
||||||
case 32: // FN+F8
|
case 32: // FN+F8
|
||||||
ScreenBrightness.Adjust(+10);
|
brightness = ScreenBrightness.Adjust(+10);
|
||||||
Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, "Brightness", ToastIcon.BrightnessUp);
|
Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, brightness + "%", ToastIcon.BrightnessUp);
|
||||||
break;
|
break;
|
||||||
case 107: // FN+F10
|
case 107: // FN+F10
|
||||||
AsusUSB.TouchpadToggle();
|
AsusUSB.TouchpadToggle();
|
||||||
|
|||||||
@@ -34,12 +34,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Adjust(int delta)
|
public static int Adjust(int delta)
|
||||||
{
|
{
|
||||||
int brightness = Get();
|
int brightness = Get();
|
||||||
Debug.WriteLine(brightness);
|
Debug.WriteLine(brightness);
|
||||||
brightness = Math.Min(100, Math.Max(0, brightness + delta));
|
brightness = Math.Min(100, Math.Max(0, brightness + delta));
|
||||||
Set(brightness);
|
Set(brightness);
|
||||||
|
return brightness;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -652,6 +652,7 @@ namespace GHelper
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
fans.FormPosition();
|
||||||
fans.Show();
|
fans.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user