Merge pull request #392 from IceStormNG/windows-power-plan-changes-optional

Windows power plan changes optional
This commit is contained in:
Serge
2023-05-16 14:53:58 +02:00
committed by GitHub
13 changed files with 71 additions and 11 deletions

23
app/Extra.Designer.cs generated
View File

@@ -74,6 +74,7 @@ namespace GHelper
checkSleepLid = new CheckBox();
checkShutdownLid = new CheckBox();
groupOther = new GroupBox();
checkAutoApplyWindowsPowerMode = new CheckBox();
checkKeyboardAuto = new CheckBox();
checkUSBC = new CheckBox();
checkNoOverdrive = new CheckBox();
@@ -574,12 +575,13 @@ namespace GHelper
//
// groupOther
//
groupOther.Controls.Add(checkAutoApplyWindowsPowerMode);
groupOther.Controls.Add(checkKeyboardAuto);
groupOther.Controls.Add(checkUSBC);
groupOther.Controls.Add(checkNoOverdrive);
groupOther.Controls.Add(checkTopmost);
groupOther.Dock = DockStyle.Top;
groupOther.Location = new Point(10, 768);
groupOther.Location = new Point(5, 358);
groupOther.Name = "groupOther";
groupOther.Size = new Size(954, 276);
groupOther.TabIndex = 2;
@@ -589,8 +591,8 @@ namespace GHelper
// checkKeyboardAuto
//
checkKeyboardAuto.AutoSize = true;
checkKeyboardAuto.Location = new Point(25, 53);
checkKeyboardAuto.MaximumSize = new Size(780, 0);
checkKeyboardAuto.Location = new Point(25, 40);
checkKeyboardAuto.Name = "checkKeyboardAuto";
checkKeyboardAuto.Size = new Size(712, 36);
checkKeyboardAuto.TabIndex = 46;
@@ -600,7 +602,7 @@ namespace GHelper
// checkUSBC
//
checkUSBC.AutoSize = true;
checkUSBC.Location = new Point(25, 210);
checkUSBC.Location = new Point(25, 85);
checkUSBC.Name = "checkUSBC";
checkUSBC.Size = new Size(659, 36);
checkUSBC.TabIndex = 4;
@@ -610,7 +612,7 @@ namespace GHelper
// checkNoOverdrive
//
checkNoOverdrive.AutoSize = true;
checkNoOverdrive.Location = new Point(25, 156);
checkNoOverdrive.Location = new Point(25, 130);
checkNoOverdrive.Name = "checkNoOverdrive";
checkNoOverdrive.Size = new Size(307, 36);
checkNoOverdrive.TabIndex = 3;
@@ -620,13 +622,23 @@ namespace GHelper
// checkTopmost
//
checkTopmost.AutoSize = true;
checkTopmost.Location = new Point(25, 104);
checkTopmost.Location = new Point(25, 175);
checkTopmost.Name = "checkTopmost";
checkTopmost.Size = new Size(390, 36);
checkTopmost.TabIndex = 1;
checkTopmost.Text = Strings.WindowTop;
checkTopmost.UseVisualStyleBackColor = true;
//
// checkAutoApplyWindowsPowerMode
//
checkAutoApplyWindowsPowerMode.AutoSize = true;
checkAutoApplyWindowsPowerMode.Location = new Point(25, 220);
checkAutoApplyWindowsPowerMode.Name = "checkAutoApplyWindowsPowerMode";
checkAutoApplyWindowsPowerMode.Size = new Size(211, 19);
checkAutoApplyWindowsPowerMode.TabIndex = 47;
checkAutoApplyWindowsPowerMode.Text = "Auto Adjust Windows Power Mode";
checkAutoApplyWindowsPowerMode.UseVisualStyleBackColor = true;
//
// Extra
//
AutoScaleDimensions = new SizeF(13F, 32F);
@@ -714,5 +726,6 @@ namespace GHelper
private Label labelBacklightTimeout;
private NumericUpDown numericBacklightTime;
private CheckBox checkKeyboardAuto;
private CheckBox checkAutoApplyWindowsPowerMode;
}
}

View File

@@ -73,6 +73,7 @@ namespace GHelper
checkNoOverdrive.Text = Properties.Strings.DisableOverdrive;
checkTopmost.Text = Properties.Strings.WindowTop;
checkUSBC.Text = Properties.Strings.OptimizedUSBC;
checkAutoApplyWindowsPowerMode.Text = Properties.Strings.ApplyWindowsPowerPlan;
labelBacklight.Text = Properties.Strings.Keyboard;
labelBacklightBar.Text = Properties.Strings.Lightbar;
@@ -176,6 +177,9 @@ namespace GHelper
checkUSBC.Checked = (Program.config.getConfig("optimized_usbc") == 1);
checkUSBC.CheckedChanged += CheckUSBC_CheckedChanged;
checkAutoApplyWindowsPowerMode.Checked = Program.config.getConfig("auto_apply_power_plan") == 1;
checkAutoApplyWindowsPowerMode.CheckedChanged += checkAutoApplyWindowsPowerMode_CheckedChanged;
int kb_brightness = Program.config.getConfig("keyboard_brightness");
trackBrightness.Value = (kb_brightness >= 0 && kb_brightness <= 3) ? kb_brightness : 3;
@@ -299,5 +303,10 @@ namespace GHelper
Top = Program.settingsForm.Top;
Left = Program.settingsForm.Left - Width - 5;
}
private void checkAutoApplyWindowsPowerMode_CheckedChanged(object? sender, EventArgs e)
{
Program.config.setConfig("auto_apply_power_plan", checkAutoApplyWindowsPowerMode.Checked ? 1 : 0);
}
}
}

View File

@@ -169,7 +169,16 @@ namespace GHelper.Properties {
}
/// <summary>
/// Looks up a localized string similar to Breathe.
/// Looks up a localized string similar to Auto Adjust Windows Power Plan.
/// </summary>
internal static string ApplyWindowsPowerPlan {
get {
return ResourceManager.GetString("ApplyWindowsPowerPlan", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Breathe.
/// </summary>
internal static string AuraBreathe {
get {

View File

@@ -94,6 +94,9 @@
<data name="ApplyPowerLimits" xml:space="preserve">
<value>Apply Power Limits</value>
</data>
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Auto Adjust Windows Power Mode</value>
</data>
<data name="AuraBreathe" xml:space="preserve">
<value>Breathe</value>
</data>

View File

@@ -153,6 +153,9 @@
<data name="ApplyPowerLimits" xml:space="preserve">
<value>Aplicar límites de energía</value>
</data>
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Auto Adjust Windows Power Mode</value>
</data>
<data name="AuraBreathe" xml:space="preserve">
<value>Respiración</value>
</data>

View File

@@ -94,6 +94,9 @@
<data name="ApplyPowerLimits" xml:space="preserve">
<value>Apply Power Limits</value>
</data>
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Auto Adjust Windows Power Mode</value>
</data>
<data name="AuraBreathe" xml:space="preserve">
<value>Breathe</value>
</data>

View File

@@ -94,6 +94,9 @@
<data name="ApplyPowerLimits" xml:space="preserve">
<value>Apply Power Limits</value>
</data>
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Auto Adjust Windows Power Mode</value>
</data>
<data name="AuraBreathe" xml:space="preserve">
<value>Breathe</value>
</data>

View File

@@ -153,6 +153,9 @@
<data name="ApplyPowerLimits" xml:space="preserve">
<value>Apply Power Limits</value>
</data>
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Auto Adjust Windows Power Plan</value>
</data>
<data name="AuraBreathe" xml:space="preserve">
<value>Breathe</value>
</data>

View File

@@ -153,6 +153,9 @@
<data name="ApplyPowerLimits" xml:space="preserve">
<value>Güç Sınırlarını Uygula</value>
</data>
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Auto Adjust Windows Power Mode</value>
</data>
<data name="AuraBreathe" xml:space="preserve">
<value>Nefes</value>
</data>

View File

@@ -153,6 +153,9 @@
<data name="ApplyPowerLimits" xml:space="preserve">
<value>Застосувати потужність</value>
</data>
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Auto Adjust Windows Power Mode</value>
</data>
<data name="AuraBreathe" xml:space="preserve">
<value>Дихання</value>
</data>

View File

@@ -153,6 +153,9 @@
<data name="ApplyPowerLimits" xml:space="preserve">
<value>应用功率限制</value>
</data>
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Auto Adjust Windows Power Mode</value>
</data>
<data name="AuraBreathe" xml:space="preserve">
<value>呼吸</value>
</data>

View File

@@ -153,6 +153,9 @@
<data name="ApplyPowerLimits" xml:space="preserve">
<value>套用功率限制</value>
</data>
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
<value>Auto Adjust Windows Power Mode</value>
</data>
<data name="AuraBreathe" xml:space="preserve">
<value>呼吸</value>
</data>

View File

@@ -1286,11 +1286,13 @@ namespace GHelper
AutoFans();
AutoPower(1000);
if (Program.config.getConfigPerfString("scheme") is not null)
NativeMethods.SetPowerScheme(Program.config.getConfigPerfString("scheme"));
else
NativeMethods.SetPowerScheme(PerformanceMode);
if (Program.config.getConfig("auto_apply_power_plan") != 0)
{
if (Program.config.getConfigPerfString("scheme") is not null)
NativeMethods.SetPowerScheme(Program.config.getConfigPerfString("scheme"));
else
NativeMethods.SetPowerScheme(PerformanceMode);
}
if (Program.config.getConfigPerf("auto_boost") != -1)
{