mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Only touch power settings if the user checks the box. But always disable the changes back to the defaults when the user unchecks it.
This commit is contained in:
11
app/Extra.cs
11
app/Extra.cs
@@ -475,7 +475,16 @@ namespace GHelper
|
|||||||
{
|
{
|
||||||
AppConfig.Set("toggle_clamshell_mode", checkAutoToggleClamshellMode.Checked ? 1 : 0);
|
AppConfig.Set("toggle_clamshell_mode", checkAutoToggleClamshellMode.Checked ? 1 : 0);
|
||||||
ClamshellModeControl ctrl = new ClamshellModeControl();
|
ClamshellModeControl ctrl = new ClamshellModeControl();
|
||||||
ctrl.ToggleLidAction();
|
|
||||||
|
if (checkAutoToggleClamshellMode.Checked)
|
||||||
|
{
|
||||||
|
ctrl.ToggleLidAction();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ClamshellModeControl.DisableClamshellMode();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,17 +46,31 @@ namespace GHelper.Helpers
|
|||||||
|
|
||||||
public void ToggleLidAction()
|
public void ToggleLidAction()
|
||||||
{
|
{
|
||||||
if (IsInClamshellMode() && IsClamshellEnabled())
|
if (!IsClamshellEnabled())
|
||||||
{
|
{
|
||||||
PowerNative.SetLidAction(0, true);
|
return;
|
||||||
Logger.WriteLine("Engaging Clamshell Mode");
|
}
|
||||||
|
|
||||||
|
if (IsInClamshellMode())
|
||||||
|
{
|
||||||
|
EnableClamshellMode();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PowerNative.SetLidAction(1, true);
|
DisableClamshellMode();
|
||||||
Logger.WriteLine("Disengaging Clamshell Mode");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static void DisableClamshellMode()
|
||||||
|
{
|
||||||
|
PowerNative.SetLidAction(1, true);
|
||||||
|
Logger.WriteLine("Disengaging Clamshell Mode");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void EnableClamshellMode()
|
||||||
|
{
|
||||||
|
PowerNative.SetLidAction(0, true);
|
||||||
|
Logger.WriteLine("Engaging Clamshell Mode");
|
||||||
|
}
|
||||||
|
|
||||||
public void UnregisterDisplayEvents()
|
public void UnregisterDisplayEvents()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user