Added Ctr+Shif+F12 binding to toggle app window

This commit is contained in:
Serge
2023-05-28 21:43:24 +02:00
parent 2041861a14
commit 3aae223b15
3 changed files with 21 additions and 18 deletions

View File

@@ -466,7 +466,6 @@ namespace GHelper
chartMid.Visible = true; chartMid.Visible = true;
SetChart(chartMid, AsusFan.Mid); SetChart(chartMid, AsusFan.Mid);
LoadProfile(seriesMid, AsusFan.Mid); LoadProfile(seriesMid, AsusFan.Mid);
Size = MinimumSize = new Size(0, chartCount * 400 + 200);
} }
else else
{ {
@@ -481,13 +480,22 @@ namespace GHelper
chartXGM.Visible = true; chartXGM.Visible = true;
SetChart(chartXGM, AsusFan.XGM); SetChart(chartXGM, AsusFan.XGM);
LoadProfile(seriesXGM, AsusFan.XGM); LoadProfile(seriesXGM, AsusFan.XGM);
Size = MinimumSize = new Size(0, chartCount * 400 + 200);
} }
else else
{ {
AppConfig.setConfig("xgm_fan", 0); AppConfig.setConfig("xgm_fan", 0);
} }
try
{
if (chartCount > 2)
Size = MinimumSize = new Size(0, (int)(ControlHelper.GetDpiScale(this).Value * (chartCount * 200 + 100)));
} catch (Exception ex)
{
Debug.WriteLine(ex);
}
SetChart(chartCPU, AsusFan.CPU); SetChart(chartCPU, AsusFan.CPU);
SetChart(chartGPU, AsusFan.GPU); SetChart(chartGPU, AsusFan.GPU);

View File

@@ -60,10 +60,11 @@ namespace GHelper
private static nint windowHandle; private static nint windowHandle;
public static Keys keyProfile = Keys.F5; public static Keys keyProfile = Keys.F5;
public static Keys keyApp = Keys.F12;
KeyboardListener listener; KeyboardListener listener;
KeyHandler m1, m2, togggle; KeyHandler m1, m2, handlerProfile, handlerApp;
public InputDispatcher(nint handle) public InputDispatcher(nint handle)
{ {
@@ -76,11 +77,12 @@ namespace GHelper
Program.acpi.SubscribeToEvents(WatcherEventArrived); Program.acpi.SubscribeToEvents(WatcherEventArrived);
//Task.Run(Program.acpi.RunListener); //Task.Run(Program.acpi.RunListener);
// CTRL + SHIFT + F5 to cycle profiles // CTRL + SHIFT + F5 to cycle profiles
if (AppConfig.getConfig("keybind_profile") != -1) keyProfile = (Keys)AppConfig.getConfig("keybind_profile"); if (AppConfig.getConfig("keybind_profile") != -1) keyProfile = (Keys)AppConfig.getConfig("keybind_profile");
togggle = new KeyHandler(KeyHandler.SHIFT | KeyHandler.CTRL, keyProfile, windowHandle); handlerProfile = new KeyHandler(KeyHandler.SHIFT | KeyHandler.CTRL, keyProfile, windowHandle);
handlerApp = new KeyHandler(KeyHandler.SHIFT | KeyHandler.CTRL, keyApp, windowHandle);
m1 = new KeyHandler(KeyHandler.NOMOD, Keys.VolumeDown, windowHandle); m1 = new KeyHandler(KeyHandler.NOMOD, Keys.VolumeDown, windowHandle);
m2 = new KeyHandler(KeyHandler.NOMOD, Keys.VolumeUp, windowHandle); m2 = new KeyHandler(KeyHandler.NOMOD, Keys.VolumeUp, windowHandle);
@@ -144,24 +146,16 @@ namespace GHelper
string actionM1 = AppConfig.getConfigString("m1"); string actionM1 = AppConfig.getConfigString("m1");
string actionM2 = AppConfig.getConfigString("m2"); string actionM2 = AppConfig.getConfigString("m2");
togggle.Unregiser(); handlerProfile.Unregiser();
m1.Unregiser(); m1.Unregiser();
m2.Unregiser(); m2.Unregiser();
if (keyProfile != Keys.None) if (keyProfile != Keys.None) handlerProfile.Register();
{ if (keyApp != Keys.None) handlerApp.Register();
togggle.Register();
}
if (actionM1 is not null && actionM1.Length > 0) if (actionM1 is not null && actionM1.Length > 0) m1.Register();
{
m1.Register();
}
if (actionM2 is not null && actionM2.Length > 0) if (actionM2 is not null && actionM2.Length > 0) m2.Register();
{
m2.Register();
}
} }

View File

@@ -194,6 +194,7 @@ namespace GHelper
break; break;
default: default:
if (key == InputDispatcher.keyProfile) CyclePerformanceMode(); if (key == InputDispatcher.keyProfile) CyclePerformanceMode();
if (key == InputDispatcher.keyApp) Program.SettingsToggle();
break; break;
} }