mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77e63f7703 | ||
|
|
8e686aded3 | ||
|
|
f866f724b2 | ||
|
|
29408c4256 | ||
|
|
c77a87f435 | ||
|
|
66a1774d78 | ||
|
|
2532aadb13 | ||
|
|
2ba6c9de20 | ||
|
|
e6938ea5cf | ||
|
|
5bf60e24b5 | ||
|
|
731a6c845f |
@@ -6,7 +6,7 @@ namespace GHelper.Display
|
||||
public class ScreenCCD
|
||||
{
|
||||
|
||||
public static bool GetHDRStatus(bool log = false)
|
||||
public static bool GetHDRStatus(bool log = true)
|
||||
{
|
||||
var err = GetDisplayConfigBufferSizes(QDC.QDC_ONLY_ACTIVE_PATHS, out var pathCount, out var modeCount);
|
||||
if (err != 0)
|
||||
@@ -46,8 +46,8 @@ namespace GHelper.Display
|
||||
info.outputTechnology == DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY.DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DISPLAYPORT_EMBEDDED ||
|
||||
info.monitorFriendlyDeviceName == internalName)
|
||||
{
|
||||
if (log) Logger.WriteLine(info.monitorFriendlyDeviceName + " HDR: " + colorInfo.advancedColorEnabled);
|
||||
return colorInfo.advancedColorEnabled;
|
||||
if (log) Logger.WriteLine(info.monitorFriendlyDeviceName + " HDR: " + colorInfo.advancedColorEnabled + " " + colorInfo.bitsPerColorChannel + " " + colorInfo.value + " " + colorInfo.wideColorEnforced);
|
||||
return colorInfo.advancedColorEnabled && colorInfo.bitsPerColorChannel > 8;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,6 +40,8 @@ namespace GHelper.Display
|
||||
private static System.Timers.Timer brightnessTimer = new System.Timers.Timer(200);
|
||||
|
||||
public const int DefaultColorTemp = 50;
|
||||
|
||||
public static bool forceVisual = false;
|
||||
static VisualControl()
|
||||
{
|
||||
brightnessTimer.Elapsed += BrightnessTimerTimer_Elapsed;
|
||||
@@ -129,8 +131,8 @@ namespace GHelper.Display
|
||||
if (mode == SplendidCommand.None) return;
|
||||
if (mode == SplendidCommand.Default && init) return; // Skip default setting on init
|
||||
|
||||
if (ScreenCCD.GetHDRStatus(true)) return;
|
||||
if (ScreenNative.GetRefreshRate(ScreenNative.FindLaptopScreen(true)) < 0) return;
|
||||
if (!forceVisual && ScreenCCD.GetHDRStatus(true)) return;
|
||||
if (!forceVisual && ScreenNative.GetRefreshRate(ScreenNative.FindLaptopScreen(true)) < 0) return;
|
||||
|
||||
if (whiteBalance != DefaultColorTemp && !init) ProcessHelper.RunAsAdmin();
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<AssemblyVersion>0.163</AssemblyVersion>
|
||||
<AssemblyVersion>0.164</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
||||
@@ -190,7 +190,7 @@ namespace GHelper.Gpu
|
||||
int chargerMode = Program.acpi.DeviceGet(AsusACPI.ChargerMode);
|
||||
Logger.WriteLine("ChargerStatus: " + chargerMode);
|
||||
|
||||
if (chargerMode < 0) return true;
|
||||
if (chargerMode <= 0) return true;
|
||||
return (chargerMode & AsusACPI.ChargerBarrel) > 0;
|
||||
|
||||
}
|
||||
|
||||
@@ -809,14 +809,14 @@ namespace GHelper.Input
|
||||
public static void ToggleScreenpad()
|
||||
{
|
||||
int toggle = AppConfig.Is("screenpad_toggle") ? 0 : 1;
|
||||
int brightness = AppConfig.Get("screenpad", 100);
|
||||
int brightness = toggle == 0 ? -10 : AppConfig.Get("screenpad", 100);
|
||||
|
||||
Program.acpi.DeviceSet(AsusACPI.ScreenPadToggle, toggle, "ScreenpadToggle");
|
||||
if (toggle > 0) Program.acpi.DeviceSet(AsusACPI.ScreenPadBrightness, Math.Max(brightness * 255 / 100, 0), "Screenpad");
|
||||
Debug.WriteLine($"Screenpad toggle = {toggle}");
|
||||
|
||||
ApplyScreenpadAction(brightness, true);
|
||||
|
||||
AppConfig.Set("screenpad_toggle", toggle);
|
||||
|
||||
|
||||
Program.toast.RunToast($"Screen Pad " + (toggle == 1 ? "On" : "Off"), toggle > 0 ? ToastIcon.BrightnessUp : ToastIcon.BrightnessDown);
|
||||
}
|
||||
|
||||
@@ -851,6 +851,37 @@ namespace GHelper.Input
|
||||
|
||||
}
|
||||
|
||||
private static System.Threading.Timer screenpadActionTimer;
|
||||
private static int screenpadBrightnessToSet;
|
||||
public static void ApplyScreenpadAction(int brightness, bool doToggle = false)
|
||||
{
|
||||
var delay = AppConfig.Get("screenpad_delay", 1500);
|
||||
|
||||
//Action
|
||||
Action<int> action = (b) =>
|
||||
{
|
||||
if (b >= 0) Program.acpi.DeviceSet(AsusACPI.ScreenPadToggle, 1, "ScreenpadOn");
|
||||
Program.acpi.DeviceSet(AsusACPI.ScreenPadBrightness, Math.Max(b * 255 / 100, 0), "Screenpad");
|
||||
if (b < 0) Program.acpi.DeviceSet(AsusACPI.ScreenPadToggle, 0, "ScreenpadOff");
|
||||
};
|
||||
|
||||
if(delay <= 0 || (brightness > 0 && brightness < 100 && doToggle == false)) //instant action
|
||||
{
|
||||
action(brightness);
|
||||
}
|
||||
else //delayed action
|
||||
{
|
||||
//Timer Approach
|
||||
if (screenpadActionTimer == null)
|
||||
{
|
||||
screenpadActionTimer = new System.Threading.Timer(_ => action(screenpadBrightnessToSet), null, Timeout.Infinite, Timeout.Infinite);
|
||||
}
|
||||
//Start Timer
|
||||
screenpadBrightnessToSet = brightness;
|
||||
screenpadActionTimer.Change(delay, Timeout.Infinite);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetScreenpad(int delta)
|
||||
{
|
||||
int brightness = AppConfig.Get("screenpad", 100);
|
||||
@@ -860,7 +891,6 @@ namespace GHelper.Input
|
||||
if (brightness < 0) brightness = 100;
|
||||
else if (brightness >= 100) brightness = 0;
|
||||
else brightness = -10;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -869,11 +899,7 @@ namespace GHelper.Input
|
||||
|
||||
AppConfig.Set("screenpad", brightness);
|
||||
|
||||
if (brightness >= 0) Program.acpi.DeviceSet(AsusACPI.ScreenPadToggle, 1, "ScreenpadOn");
|
||||
|
||||
Program.acpi.DeviceSet(AsusACPI.ScreenPadBrightness, Math.Max(brightness * 255 / 100, 0), "Screenpad");
|
||||
|
||||
if (brightness < 0) Program.acpi.DeviceSet(AsusACPI.ScreenPadToggle, 0, "ScreenpadOff");
|
||||
ApplyScreenpadAction(brightness);
|
||||
|
||||
string toast;
|
||||
|
||||
@@ -882,10 +908,8 @@ namespace GHelper.Input
|
||||
else toast = brightness.ToString() + "%";
|
||||
|
||||
Program.toast.RunToast($"Screen Pad {toast}", delta > 0 ? ToastIcon.BrightnessUp : ToastIcon.BrightnessDown);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void LaunchProcess(string command = "")
|
||||
{
|
||||
|
||||
|
||||
@@ -494,6 +494,9 @@ Trotzdem fortfahren?</value>
|
||||
<data name="LaptopScreen" xml:space="preserve">
|
||||
<value>Laptopbildschirm</value>
|
||||
</data>
|
||||
<data name="LEDStatusIndicators" xml:space="preserve">
|
||||
<value>LED Status Indicators</value>
|
||||
</data>
|
||||
<data name="Lid" xml:space="preserve">
|
||||
<value>Deckel</value>
|
||||
</data>
|
||||
@@ -768,10 +771,10 @@ Trotzdem fortfahren?</value>
|
||||
<value>Darstellungsmodus</value>
|
||||
</data>
|
||||
<data name="VisualModesHDR" xml:space="preserve">
|
||||
<value>Visual Modes are not available when HDR is active</value>
|
||||
<value>Darstellungsmodi sind nicht verfügbar, wenn HDR aktiv ist.</value>
|
||||
</data>
|
||||
<data name="VisualModesScreen" xml:space="preserve">
|
||||
<value>Visual Modes are not available when laptop screen is off</value>
|
||||
<value>Darstellungsmodi sind nicht verfügbar, wenn Laptop-Bildschirm aus ist.</value>
|
||||
</data>
|
||||
<data name="VolumeDown" xml:space="preserve">
|
||||
<value>Lautstärke verringern</value>
|
||||
|
||||
@@ -494,6 +494,9 @@
|
||||
<data name="LaptopScreen" xml:space="preserve">
|
||||
<value>Pantalla del portátil</value>
|
||||
</data>
|
||||
<data name="LEDStatusIndicators" xml:space="preserve">
|
||||
<value>Indicadores de estado LED</value>
|
||||
</data>
|
||||
<data name="Lid" xml:space="preserve">
|
||||
<value>Tapa</value>
|
||||
</data>
|
||||
@@ -768,10 +771,10 @@
|
||||
<value>Modo visual</value>
|
||||
</data>
|
||||
<data name="VisualModesHDR" xml:space="preserve">
|
||||
<value>Visual Modes are not available when HDR is active</value>
|
||||
<value>Los modos visuales no están disponibles cuando el HDR está activo</value>
|
||||
</data>
|
||||
<data name="VisualModesScreen" xml:space="preserve">
|
||||
<value>Visual Modes are not available when laptop screen is off</value>
|
||||
<value>Los modos visuales no están disponibles cuando la pantalla portátil está apagada</value>
|
||||
</data>
|
||||
<data name="VolumeDown" xml:space="preserve">
|
||||
<value>Bajar volumen</value>
|
||||
|
||||
@@ -494,6 +494,9 @@ Voulez-vous continuer ?</value>
|
||||
<data name="LaptopScreen" xml:space="preserve">
|
||||
<value>Écran</value>
|
||||
</data>
|
||||
<data name="LEDStatusIndicators" xml:space="preserve">
|
||||
<value>LED Status Indicators</value>
|
||||
</data>
|
||||
<data name="Lid" xml:space="preserve">
|
||||
<value>Capot</value>
|
||||
</data>
|
||||
|
||||
@@ -494,6 +494,9 @@ Do you still want to continue?</value>
|
||||
<data name="LaptopScreen" xml:space="preserve">
|
||||
<value>Laptop kijelző</value>
|
||||
</data>
|
||||
<data name="LEDStatusIndicators" xml:space="preserve">
|
||||
<value>LED Status Indicators</value>
|
||||
</data>
|
||||
<data name="Lid" xml:space="preserve">
|
||||
<value>Fedél</value>
|
||||
</data>
|
||||
|
||||
@@ -494,6 +494,9 @@ Apakah Anda masih ingin melanjutkan?</value>
|
||||
<data name="LaptopScreen" xml:space="preserve">
|
||||
<value>Layar Laptop</value>
|
||||
</data>
|
||||
<data name="LEDStatusIndicators" xml:space="preserve">
|
||||
<value>LED Status Indicators</value>
|
||||
</data>
|
||||
<data name="Lid" xml:space="preserve">
|
||||
<value>Lid</value>
|
||||
</data>
|
||||
|
||||
@@ -494,6 +494,9 @@ Sei sicuro di voler continuare?</value>
|
||||
<data name="LaptopScreen" xml:space="preserve">
|
||||
<value>Schermo Laptop</value>
|
||||
</data>
|
||||
<data name="LEDStatusIndicators" xml:space="preserve">
|
||||
<value>LED Status Indicators</value>
|
||||
</data>
|
||||
<data name="Lid" xml:space="preserve">
|
||||
<value>Lid</value>
|
||||
</data>
|
||||
|
||||
@@ -494,6 +494,9 @@
|
||||
<data name="LaptopScreen" xml:space="preserve">
|
||||
<value>화면</value>
|
||||
</data>
|
||||
<data name="LEDStatusIndicators" xml:space="preserve">
|
||||
<value>LED Status Indicators</value>
|
||||
</data>
|
||||
<data name="Lid" xml:space="preserve">
|
||||
<value>덮개</value>
|
||||
</data>
|
||||
|
||||
@@ -494,6 +494,9 @@ Vis tiek norite tęsti?</value>
|
||||
<data name="LaptopScreen" xml:space="preserve">
|
||||
<value>Ekranas</value>
|
||||
</data>
|
||||
<data name="LEDStatusIndicators" xml:space="preserve">
|
||||
<value>LED Status Indicators</value>
|
||||
</data>
|
||||
<data name="Lid" xml:space="preserve">
|
||||
<value>Dangtis</value>
|
||||
</data>
|
||||
|
||||
@@ -494,6 +494,9 @@ Nadal chcesz kontynuować?</value>
|
||||
<data name="LaptopScreen" xml:space="preserve">
|
||||
<value>Ekran laptopa</value>
|
||||
</data>
|
||||
<data name="LEDStatusIndicators" xml:space="preserve">
|
||||
<value>LED Status Indicators</value>
|
||||
</data>
|
||||
<data name="Lid" xml:space="preserve">
|
||||
<value>Pokrywa</value>
|
||||
</data>
|
||||
|
||||
@@ -494,6 +494,9 @@ Do you still want to continue?</value>
|
||||
<data name="LaptopScreen" xml:space="preserve">
|
||||
<value>Tela</value>
|
||||
</data>
|
||||
<data name="LEDStatusIndicators" xml:space="preserve">
|
||||
<value>LED Status Indicators</value>
|
||||
</data>
|
||||
<data name="Lid" xml:space="preserve">
|
||||
<value>Tampa</value>
|
||||
</data>
|
||||
|
||||
@@ -494,6 +494,9 @@ Quer prosseguir?</value>
|
||||
<data name="LaptopScreen" xml:space="preserve">
|
||||
<value>Ecrã</value>
|
||||
</data>
|
||||
<data name="LEDStatusIndicators" xml:space="preserve">
|
||||
<value>LED Status Indicators</value>
|
||||
</data>
|
||||
<data name="Lid" xml:space="preserve">
|
||||
<value>Tampa</value>
|
||||
</data>
|
||||
|
||||
@@ -494,6 +494,9 @@
|
||||
<data name="LaptopScreen" xml:space="preserve">
|
||||
<value>Ecran Laptop</value>
|
||||
</data>
|
||||
<data name="LEDStatusIndicators" xml:space="preserve">
|
||||
<value>LED Status Indicators</value>
|
||||
</data>
|
||||
<data name="Lid" xml:space="preserve">
|
||||
<value>Capac</value>
|
||||
</data>
|
||||
|
||||
@@ -494,6 +494,9 @@ Yine de devam etmek istiyor musunuz?</value>
|
||||
<data name="LaptopScreen" xml:space="preserve">
|
||||
<value>Laptop Ekranı</value>
|
||||
</data>
|
||||
<data name="LEDStatusIndicators" xml:space="preserve">
|
||||
<value>LED Status Indicators</value>
|
||||
</data>
|
||||
<data name="Lid" xml:space="preserve">
|
||||
<value>Kapak</value>
|
||||
</data>
|
||||
|
||||
@@ -494,6 +494,9 @@
|
||||
<data name="LaptopScreen" xml:space="preserve">
|
||||
<value>Дисплей</value>
|
||||
</data>
|
||||
<data name="LEDStatusIndicators" xml:space="preserve">
|
||||
<value>LED Status Indicators</value>
|
||||
</data>
|
||||
<data name="Lid" xml:space="preserve">
|
||||
<value>Кришка</value>
|
||||
</data>
|
||||
|
||||
@@ -494,6 +494,9 @@ Do you still want to continue?</value>
|
||||
<data name="LaptopScreen" xml:space="preserve">
|
||||
<value>Màn hình Laptop</value>
|
||||
</data>
|
||||
<data name="LEDStatusIndicators" xml:space="preserve">
|
||||
<value>LED Status Indicators</value>
|
||||
</data>
|
||||
<data name="Lid" xml:space="preserve">
|
||||
<value>Màn gập</value>
|
||||
</data>
|
||||
|
||||
@@ -494,6 +494,9 @@
|
||||
<data name="LaptopScreen" xml:space="preserve">
|
||||
<value>笔记本屏幕</value>
|
||||
</data>
|
||||
<data name="LEDStatusIndicators" xml:space="preserve">
|
||||
<value>LED Status Indicators</value>
|
||||
</data>
|
||||
<data name="Lid" xml:space="preserve">
|
||||
<value>盖子</value>
|
||||
</data>
|
||||
|
||||
@@ -494,6 +494,9 @@
|
||||
<data name="LaptopScreen" xml:space="preserve">
|
||||
<value>螢幕顯示</value>
|
||||
</data>
|
||||
<data name="LEDStatusIndicators" xml:space="preserve">
|
||||
<value>LED狀態指示器</value>
|
||||
</data>
|
||||
<data name="Lid" xml:space="preserve">
|
||||
<value>螢幕背蓋</value>
|
||||
</data>
|
||||
@@ -768,10 +771,10 @@
|
||||
<value>色域模式</value>
|
||||
</data>
|
||||
<data name="VisualModesHDR" xml:space="preserve">
|
||||
<value>Visual Modes are not available when HDR is active</value>
|
||||
<value>HDR開啟時不支援色域模式</value>
|
||||
</data>
|
||||
<data name="VisualModesScreen" xml:space="preserve">
|
||||
<value>Visual Modes are not available when laptop screen is off</value>
|
||||
<value>筆電螢幕闔上時不支援色域模式</value>
|
||||
</data>
|
||||
<data name="VolumeDown" xml:space="preserve">
|
||||
<value>音量降低</value>
|
||||
|
||||
4
app/Settings.Designer.cs
generated
4
app/Settings.Designer.cs
generated
@@ -1408,6 +1408,7 @@ namespace GHelper
|
||||
labelCharge.Size = new Size(461, 56);
|
||||
labelCharge.TabIndex = 40;
|
||||
labelCharge.TextAlign = ContentAlignment.MiddleRight;
|
||||
labelCharge.Cursor = Cursors.Hand;
|
||||
//
|
||||
// panelPeripherals
|
||||
//
|
||||
@@ -1705,6 +1706,7 @@ namespace GHelper
|
||||
//
|
||||
// labelVisual
|
||||
//
|
||||
labelVisual.Cursor = Cursors.Hand;
|
||||
labelVisual.ForeColor = SystemColors.GrayText;
|
||||
labelVisual.Location = new Point(20, 170);
|
||||
labelVisual.Margin = new Padding(4, 0, 4, 0);
|
||||
@@ -1874,7 +1876,7 @@ namespace GHelper
|
||||
AutoScaleMode = AutoScaleMode.Dpi;
|
||||
AutoSize = true;
|
||||
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
ClientSize = new Size(849, 1559);
|
||||
ClientSize = new Size(849, 2045);
|
||||
Controls.Add(panelFooter);
|
||||
Controls.Add(panelVersion);
|
||||
Controls.Add(panelBattery);
|
||||
|
||||
@@ -256,10 +256,25 @@ namespace GHelper
|
||||
VisualiseFnLock();
|
||||
buttonFnLock.Click += ButtonFnLock_Click;
|
||||
|
||||
labelVisual.Click += LabelVisual_Click;
|
||||
labelCharge.Click += LabelCharge_Click;
|
||||
|
||||
panelPerformance.Focus();
|
||||
InitVisual();
|
||||
}
|
||||
|
||||
private void LabelCharge_Click(object? sender, EventArgs e)
|
||||
{
|
||||
var report = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\battery-report.html";
|
||||
ProcessHelper.RunCMD("powershell", $"powercfg /batteryreport /output \"{report}\"");
|
||||
ProcessHelper.RunCMD("explorer", $"\"{report}\"");
|
||||
}
|
||||
|
||||
private void LabelVisual_Click(object? sender, EventArgs e)
|
||||
{
|
||||
labelVisual.Visible = false;
|
||||
VisualControl.forceVisual = true;
|
||||
}
|
||||
|
||||
public void InitVisual()
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# G-Helper - Lightweight control tool for Asus laptops
|
||||
[](https://u24.gov.ua/)
|
||||
[](https://GitHub.com/seerge/g-helper/releases/)
|
||||
[](https://GitHub.com/seerge/g-helper/releases/) [](https://GitHub.com/seerge/g-helper/stargazers/)
|
||||
[](https://GitHub.com/seerge/g-helper/releases/) [](https://GitHub.com/seerge/g-helper/stargazers/) <sup>[中文版点这里](https://github.com/seerge/g-helper/blob/main/docs/README.zh-CN.md)</sup>
|
||||
|
||||
Small and lightweight Armoury Crate alternative for Asus laptops offering almost same functionality without extra load and unnecessary services.
|
||||
Works with all popular models, such as ROG Zephyrus G14, G15, G16, M16, Flow X13, Flow X16, Flow Z13, TUF Series, Strix / Scar Series, ProArt, Vivobook, Zenbook, ROG Ally and many more!
|
||||
|
||||
Reference in New Issue
Block a user