From e6938ea5cf81d873242fc860e403837e20d7685a Mon Sep 17 00:00:00 2001 From: Vaibhav Garg Date: Wed, 27 Mar 2024 22:49:36 +0530 Subject: [PATCH 1/2] Add Delay to Screenpad Actions (#2305) * Add Delay to Screenpad Actions Added "screenpad_delay" config * revert .net version revert .net version --- app/Input/InputDispatcher.cs | 48 +++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/app/Input/InputDispatcher.cs b/app/Input/InputDispatcher.cs index f00bb874..566e1da2 100644 --- a/app/Input/InputDispatcher.cs +++ b/app/Input/InputDispatcher.cs @@ -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 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 = "") { From 2ba6c9de20d7dc22f3c0efb28082bb67cf73e2aa Mon Sep 17 00:00:00 2001 From: Serge <5920850+seerge@users.noreply.github.com> Date: Wed, 27 Mar 2024 18:19:45 +0100 Subject: [PATCH 2/2] New Crowdin updates (#2310) * New translations strings.resx (Romanian) * New translations strings.resx (French) * New translations strings.resx (Spanish) * New translations strings.resx (German) * New translations strings.resx (Hungarian) * New translations strings.resx (Italian) * New translations strings.resx (Korean) * New translations strings.resx (Lithuanian) * New translations strings.resx (Polish) * New translations strings.resx (Portuguese) * New translations strings.resx (Turkish) * New translations strings.resx (Ukrainian) * New translations strings.resx (Chinese Simplified) * New translations strings.resx (Chinese Traditional) * New translations strings.resx (Vietnamese) * New translations strings.resx (Portuguese, Brazilian) * New translations strings.resx (Indonesian) * New translations strings.resx (Spanish) * New translations strings.resx (Chinese Traditional) --- app/Properties/Strings.de.resx | 7 +++++-- app/Properties/Strings.es.resx | 7 +++++-- app/Properties/Strings.fr.resx | 3 +++ app/Properties/Strings.hu.resx | 3 +++ app/Properties/Strings.id.resx | 3 +++ app/Properties/Strings.it.resx | 3 +++ app/Properties/Strings.ko.resx | 3 +++ app/Properties/Strings.lt.resx | 3 +++ app/Properties/Strings.pl.resx | 3 +++ app/Properties/Strings.pt-BR.resx | 3 +++ app/Properties/Strings.pt-PT.resx | 3 +++ app/Properties/Strings.ro.resx | 3 +++ app/Properties/Strings.tr.resx | 3 +++ app/Properties/Strings.uk.resx | 3 +++ app/Properties/Strings.vi.resx | 3 +++ app/Properties/Strings.zh-CN.resx | 3 +++ app/Properties/Strings.zh-TW.resx | 7 +++++-- 17 files changed, 57 insertions(+), 6 deletions(-) diff --git a/app/Properties/Strings.de.resx b/app/Properties/Strings.de.resx index 82002635..dfdf8414 100644 --- a/app/Properties/Strings.de.resx +++ b/app/Properties/Strings.de.resx @@ -494,6 +494,9 @@ Trotzdem fortfahren? Laptopbildschirm + + LED Status Indicators + Deckel @@ -768,10 +771,10 @@ Trotzdem fortfahren? Darstellungsmodus - Visual Modes are not available when HDR is active + Darstellungsmodi sind nicht verfügbar, wenn HDR aktiv ist. - Visual Modes are not available when laptop screen is off + Darstellungsmodi sind nicht verfügbar, wenn Laptop-Bildschirm aus ist. Lautstärke verringern diff --git a/app/Properties/Strings.es.resx b/app/Properties/Strings.es.resx index 8130335b..e240f878 100644 --- a/app/Properties/Strings.es.resx +++ b/app/Properties/Strings.es.resx @@ -494,6 +494,9 @@ Pantalla del portátil + + Indicadores de estado LED + Tapa @@ -768,10 +771,10 @@ Modo visual - Visual Modes are not available when HDR is active + Los modos visuales no están disponibles cuando el HDR está activo - Visual Modes are not available when laptop screen is off + Los modos visuales no están disponibles cuando la pantalla portátil está apagada Bajar volumen diff --git a/app/Properties/Strings.fr.resx b/app/Properties/Strings.fr.resx index dbc01500..f4c456d2 100644 --- a/app/Properties/Strings.fr.resx +++ b/app/Properties/Strings.fr.resx @@ -494,6 +494,9 @@ Voulez-vous continuer ? Écran + + LED Status Indicators + Capot diff --git a/app/Properties/Strings.hu.resx b/app/Properties/Strings.hu.resx index a13192d6..b00038b1 100644 --- a/app/Properties/Strings.hu.resx +++ b/app/Properties/Strings.hu.resx @@ -494,6 +494,9 @@ Do you still want to continue? Laptop kijelző + + LED Status Indicators + Fedél diff --git a/app/Properties/Strings.id.resx b/app/Properties/Strings.id.resx index 6e93357f..54e92d32 100644 --- a/app/Properties/Strings.id.resx +++ b/app/Properties/Strings.id.resx @@ -494,6 +494,9 @@ Apakah Anda masih ingin melanjutkan? Layar Laptop + + LED Status Indicators + Lid diff --git a/app/Properties/Strings.it.resx b/app/Properties/Strings.it.resx index c00f57cd..bf6f96ef 100644 --- a/app/Properties/Strings.it.resx +++ b/app/Properties/Strings.it.resx @@ -494,6 +494,9 @@ Sei sicuro di voler continuare? Schermo Laptop + + LED Status Indicators + Lid diff --git a/app/Properties/Strings.ko.resx b/app/Properties/Strings.ko.resx index 17851bde..71ef9cce 100644 --- a/app/Properties/Strings.ko.resx +++ b/app/Properties/Strings.ko.resx @@ -494,6 +494,9 @@ 화면 + + LED Status Indicators + 덮개 diff --git a/app/Properties/Strings.lt.resx b/app/Properties/Strings.lt.resx index aa26de26..4e37cc79 100644 --- a/app/Properties/Strings.lt.resx +++ b/app/Properties/Strings.lt.resx @@ -494,6 +494,9 @@ Vis tiek norite tęsti? Ekranas + + LED Status Indicators + Dangtis diff --git a/app/Properties/Strings.pl.resx b/app/Properties/Strings.pl.resx index 8558b942..e81497bc 100644 --- a/app/Properties/Strings.pl.resx +++ b/app/Properties/Strings.pl.resx @@ -494,6 +494,9 @@ Nadal chcesz kontynuować? Ekran laptopa + + LED Status Indicators + Pokrywa diff --git a/app/Properties/Strings.pt-BR.resx b/app/Properties/Strings.pt-BR.resx index cd6ae546..7f531b14 100644 --- a/app/Properties/Strings.pt-BR.resx +++ b/app/Properties/Strings.pt-BR.resx @@ -494,6 +494,9 @@ Do you still want to continue? Tela + + LED Status Indicators + Tampa diff --git a/app/Properties/Strings.pt-PT.resx b/app/Properties/Strings.pt-PT.resx index 7262ec76..5fdd8854 100644 --- a/app/Properties/Strings.pt-PT.resx +++ b/app/Properties/Strings.pt-PT.resx @@ -494,6 +494,9 @@ Quer prosseguir? Ecrã + + LED Status Indicators + Tampa diff --git a/app/Properties/Strings.ro.resx b/app/Properties/Strings.ro.resx index 893d80c9..fa2c25db 100644 --- a/app/Properties/Strings.ro.resx +++ b/app/Properties/Strings.ro.resx @@ -494,6 +494,9 @@ Ecran Laptop + + LED Status Indicators + Capac diff --git a/app/Properties/Strings.tr.resx b/app/Properties/Strings.tr.resx index d952bacf..6fa51165 100644 --- a/app/Properties/Strings.tr.resx +++ b/app/Properties/Strings.tr.resx @@ -494,6 +494,9 @@ Yine de devam etmek istiyor musunuz? Laptop Ekranı + + LED Status Indicators + Kapak diff --git a/app/Properties/Strings.uk.resx b/app/Properties/Strings.uk.resx index cfdf4cd7..356536cf 100644 --- a/app/Properties/Strings.uk.resx +++ b/app/Properties/Strings.uk.resx @@ -494,6 +494,9 @@ Дисплей + + LED Status Indicators + Кришка diff --git a/app/Properties/Strings.vi.resx b/app/Properties/Strings.vi.resx index 6fab09b5..22b23dbb 100644 --- a/app/Properties/Strings.vi.resx +++ b/app/Properties/Strings.vi.resx @@ -494,6 +494,9 @@ Do you still want to continue? Màn hình Laptop + + LED Status Indicators + Màn gập diff --git a/app/Properties/Strings.zh-CN.resx b/app/Properties/Strings.zh-CN.resx index 2513e76a..647157f0 100644 --- a/app/Properties/Strings.zh-CN.resx +++ b/app/Properties/Strings.zh-CN.resx @@ -494,6 +494,9 @@ 笔记本屏幕 + + LED Status Indicators + 盖子 diff --git a/app/Properties/Strings.zh-TW.resx b/app/Properties/Strings.zh-TW.resx index 1688fb08..066e4122 100644 --- a/app/Properties/Strings.zh-TW.resx +++ b/app/Properties/Strings.zh-TW.resx @@ -494,6 +494,9 @@ 螢幕顯示 + + LED狀態指示器 + 螢幕背蓋 @@ -768,10 +771,10 @@ 色域模式 - Visual Modes are not available when HDR is active + HDR開啟時不支援色域模式 - Visual Modes are not available when laptop screen is off + 筆電螢幕闔上時不支援色域模式 音量降低