mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Native brightness OSD
This commit is contained in:
@@ -26,7 +26,7 @@ namespace GHelper.AnimeMatrix
|
||||
try
|
||||
{
|
||||
mat = new AnimeMatrixDevice();
|
||||
mat.WakeUp();
|
||||
Task.Run(mat.WakeUp);
|
||||
matrixTimer = new System.Timers.Timer(100);
|
||||
matrixTimer.Elapsed += MatrixTimer_Elapsed;
|
||||
}
|
||||
@@ -123,6 +123,11 @@ namespace GHelper.AnimeMatrix
|
||||
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
StopMatrixAudio();
|
||||
}
|
||||
|
||||
void StopMatrixAudio()
|
||||
{
|
||||
if (AudioDevice is not null)
|
||||
|
||||
@@ -193,10 +193,11 @@ namespace GHelper
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void TouchpadToggle()
|
||||
public static bool TouchpadToggle()
|
||||
{
|
||||
HidDevice? input = GetInputDevice();
|
||||
if (input != null) input.WriteFeatureData(new byte[] { HID_ID,0xf4,0x6b});
|
||||
if (input != null) return input.WriteFeatureData(new byte[] { HID_ID,0xf4,0x6b});
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void RunListener(Action<int> KeyHandler)
|
||||
@@ -249,7 +250,8 @@ namespace GHelper
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
var devices = GetHidDevices(deviceIds);
|
||||
foreach (HidDevice device in devices)
|
||||
{
|
||||
@@ -261,10 +263,13 @@ namespace GHelper
|
||||
device.WriteFeatureData(LED_INIT5);
|
||||
device.CloseDevice();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public static void ApplyBrightness(int brightness)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
byte[] msg = { 0x5d, 0xba, 0xc5, 0xc4, (byte)brightness };
|
||||
|
||||
@@ -279,6 +284,7 @@ namespace GHelper
|
||||
|
||||
if (AppConfig.ContainsModel("TUF"))
|
||||
Program.acpi.TUFKeyboardBrightness(brightness);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public static class HardwareControl
|
||||
if (fan > fanMax && fan < 110) SetFanMax(fan);
|
||||
|
||||
if (AppConfig.getConfig("fan_rpm") == 1)
|
||||
return GHelper.Properties.Strings.FanSpeed + (fan * 100).ToString() + GHelper.Properties.Strings.RPM;
|
||||
return GHelper.Properties.Strings.FanSpeed + (fan * 100).ToString() + "RPM";
|
||||
else
|
||||
return GHelper.Properties.Strings.FanSpeed + Math.Min(Math.Round((float)fan / fanMax * 100), 100).ToString() + "%"; // relatively to 6000 rpm
|
||||
}
|
||||
|
||||
@@ -213,16 +213,18 @@ namespace GHelper
|
||||
Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, backlightNames[backlight], ToastIcon.BacklightUp);
|
||||
break;
|
||||
case 16: // FN+F7
|
||||
brightness = ScreenBrightness.Adjust(-10);
|
||||
Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, brightness + "%", ToastIcon.BrightnessDown);
|
||||
Program.acpi.DeviceSet(AsusACPI.UniversalControl, 0x10, "Brightness");
|
||||
//brightness = ScreenBrightness.Adjust(-10);
|
||||
//Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, brightness + "%", ToastIcon.BrightnessDown);
|
||||
break;
|
||||
case 32: // FN+F8
|
||||
brightness = ScreenBrightness.Adjust(+10);
|
||||
Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, brightness + "%", ToastIcon.BrightnessUp);
|
||||
Program.acpi.DeviceSet(AsusACPI.UniversalControl, 0x20, "Brightness");
|
||||
//brightness = ScreenBrightness.Adjust(+10);
|
||||
//Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, brightness + "%", ToastIcon.BrightnessUp);
|
||||
break;
|
||||
case 107: // FN+F10
|
||||
bool touchpadState = GetTouchpadState();
|
||||
AsusUSB.TouchpadToggle();
|
||||
if (!AsusUSB.TouchpadToggle()) Program.acpi.DeviceSet(AsusACPI.UniversalControl, 0x6B, "Touchpad");
|
||||
Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, touchpadState ? "Off" : "On", ToastIcon.Touchpad);
|
||||
break;
|
||||
case 108: // FN+F11
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace GHelper
|
||||
Thread.CurrentThread.CurrentUICulture = CultureInfo.CurrentUICulture;
|
||||
Debug.WriteLine(CultureInfo.CurrentUICulture);
|
||||
|
||||
//Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("es");
|
||||
//Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("uk");
|
||||
|
||||
CheckProcesses();
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace GHelper
|
||||
}
|
||||
|
||||
Logger.WriteLine("------------");
|
||||
Logger.WriteLine("App launched: " + AppConfig.GetModel() + " :" + Assembly.GetExecutingAssembly().GetName().Version.ToString() + (IsUserAdministrator() ? "A" : ""));
|
||||
Logger.WriteLine("App launched: " + AppConfig.GetModel() + " :" + Assembly.GetExecutingAssembly().GetName().Version.ToString() + CultureInfo.CurrentUICulture + (IsUserAdministrator() ? "A" : ""));
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
|
||||
|
||||
2
app/Properties/Strings.Designer.cs
generated
2
app/Properties/Strings.Designer.cs
generated
@@ -169,7 +169,7 @@ namespace GHelper.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Auto adjust Windows Power Mode.
|
||||
/// Looks up a localized string similar to Auto adjust Windows Power Modes.
|
||||
/// </summary>
|
||||
internal static string ApplyWindowsPowerPlan {
|
||||
get {
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
<value>Apply Power Limits</value>
|
||||
</data>
|
||||
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
|
||||
<value>Auto adjust Windows Power Mode</value>
|
||||
<value>Auto adjust Windows Power Modes</value>
|
||||
</data>
|
||||
<data name="AuraBreathe" xml:space="preserve">
|
||||
<value>Breathe</value>
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
<value>Застосувати потужність</value>
|
||||
</data>
|
||||
<data name="ApplyWindowsPowerPlan" xml:space="preserve">
|
||||
<value>Автоматично застосовувати Windows Power Mode</value>
|
||||
<value>Автоматично застосовувати Windows Power Modes</value>
|
||||
</data>
|
||||
<data name="AuraBreathe" xml:space="preserve">
|
||||
<value>Дихання</value>
|
||||
|
||||
@@ -889,6 +889,7 @@ namespace GHelper
|
||||
|
||||
private void ButtonQuit_Click(object? sender, EventArgs e)
|
||||
{
|
||||
matrix.Dispose();
|
||||
Close();
|
||||
Program.trayIcon.Visible = false;
|
||||
Application.Exit();
|
||||
|
||||
Reference in New Issue
Block a user