Skip to content

Commit

Permalink
CameraShutter cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
seerge committed Nov 10, 2024
1 parent 000162b commit c6ea0b0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
5 changes: 0 additions & 5 deletions app/AppConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -698,11 +698,6 @@ public static bool IsForceMiniled()
{
return ContainsModel("G834JYR") || ContainsModel("G834JZR") || Is("force_miniled");
}
public static bool IsCameraShutter()
{
return ContainsModel("UX5401") || ContainsModel("UX5406");
}

public static bool SaveDimming()
{
return Is("save_dimming");
Expand Down
28 changes: 13 additions & 15 deletions app/Input/InputDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ public void KeyPressed(object sender, KeyPressedEventArgs e)
if (e.Modifier == (ModifierKeys.Control | ModifierKeys.Shift | ModifierKeys.Alt))
{
if (e.Key == keyProfile) modeControl.CyclePerformanceMode(true);

if (e.Key == keyProfile0) modeControl.SetPerformanceMode(0, true);
if (e.Key == keyProfile1) modeControl.SetPerformanceMode(1, true);
if (e.Key == keyProfile2) modeControl.SetPerformanceMode(2, true);
Expand Down Expand Up @@ -664,7 +664,7 @@ public static void ToggleFnLock()
bool fnLock = !AppConfig.Is("fn_lock");
AppConfig.Set("fn_lock", fnLock ? 1 : 0);

if (AppConfig.IsHardwareFnLock())
if (AppConfig.IsHardwareFnLock())
HardwareFnLock(fnLock);
else
Program.settingsForm.BeginInvoke(Program.inputDispatcher.RegisterKeys);
Expand Down Expand Up @@ -944,19 +944,17 @@ public static void ToggleScreenRate()

public static void ToggleCamera()
{
if(AppConfig.IsCameraShutter())
{
if(Program.acpi.DeviceGet(AsusACPI.CameraShutter)==0)
{
Program.acpi.DeviceSet(AsusACPI.CameraShutter, 1, "CameraShutterOn");
Program.toast.RunToast($"Camera Off");
int cameraShutter = Program.acpi.DeviceGet(AsusACPI.CameraShutter);

}
else
{
Program.acpi.DeviceSet(AsusACPI.CameraShutter, 0, "CameraShutterOff");
Program.toast.RunToast($"Camera On");
}
if (cameraShutter == 0)
{
Program.acpi.DeviceSet(AsusACPI.CameraShutter, 1, "CameraShutterOn");
Program.toast.RunToast($"Camera Off");
}
else if (cameraShutter == 1)
{
Program.acpi.DeviceSet(AsusACPI.CameraShutter, 0, "CameraShutterOff");
Program.toast.RunToast($"Camera On");
}
else
{
Expand Down Expand Up @@ -1004,7 +1002,7 @@ public static void ApplyScreenpadAction(int brightness, bool instant = true)
if (b < 0) Program.acpi.DeviceSet(AsusACPI.ScreenPadToggle, 0, "ScreenpadOff");
};

if(delay <= 0 || instant) //instant action
if (delay <= 0 || instant) //instant action
{
action(brightness);
}
Expand Down

0 comments on commit c6ea0b0

Please sign in to comment.