Added FN+C binding for Fn-Lock

This commit is contained in:
Serge
2023-06-01 20:07:51 +02:00
parent 314d25c751
commit e69845e858
10 changed files with 125 additions and 17 deletions

55
app/Extra.Designer.cs generated
View File

@@ -90,6 +90,9 @@ namespace GHelper
checkUSBC = new CheckBox();
checkNoOverdrive = new CheckBox();
checkTopmost = new CheckBox();
labelFNC = new Label();
comboFNC = new RComboBox();
textFNC = new TextBox();
groupBindings.SuspendLayout();
tableKeys.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureHelp).BeginInit();
@@ -110,7 +113,7 @@ namespace GHelper
groupBindings.Dock = DockStyle.Top;
groupBindings.Location = new Point(10, 10);
groupBindings.Name = "groupBindings";
groupBindings.Size = new Size(954, 324);
groupBindings.Size = new Size(954, 376);
groupBindings.TabIndex = 0;
groupBindings.TabStop = false;
groupBindings.Text = "Key Bindings";
@@ -121,31 +124,35 @@ namespace GHelper
tableKeys.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
tableKeys.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40F));
tableKeys.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40F));
tableKeys.Controls.Add(labelFNC, 0, 5);
tableKeys.Controls.Add(textM2, 2, 1);
tableKeys.Controls.Add(textM1, 2, 0);
tableKeys.Controls.Add(comboM1, 1, 0);
tableKeys.Controls.Add(labelM1, 0, 0);
tableKeys.Controls.Add(labelFNF4, 0, 4);
tableKeys.Controls.Add(comboFNF4, 1, 4);
tableKeys.Controls.Add(comboM4, 1, 3);
tableKeys.Controls.Add(comboM3, 1, 2);
tableKeys.Controls.Add(textFNF4, 2, 4);
tableKeys.Controls.Add(textM4, 2, 3);
tableKeys.Controls.Add(textM3, 2, 2);
tableKeys.Controls.Add(labelM4, 0, 3);
tableKeys.Controls.Add(labelM3, 0, 2);
tableKeys.Controls.Add(labelM2, 0, 1);
tableKeys.Controls.Add(comboM2, 1, 1);
tableKeys.Controls.Add(labelFNF4, 0, 4);
tableKeys.Controls.Add(comboFNF4, 1, 4);
tableKeys.Controls.Add(textFNF4, 2, 4);
tableKeys.Controls.Add(comboFNC, 1, 5);
tableKeys.Controls.Add(textFNC, 2, 5);
tableKeys.Location = new Point(13, 38);
tableKeys.Name = "tableKeys";
tableKeys.Padding = new Padding(10);
tableKeys.RowCount = 5;
tableKeys.RowCount = 6;
tableKeys.RowStyles.Add(new RowStyle(SizeType.Absolute, 50F));
tableKeys.RowStyles.Add(new RowStyle(SizeType.Absolute, 50F));
tableKeys.RowStyles.Add(new RowStyle(SizeType.Absolute, 50F));
tableKeys.RowStyles.Add(new RowStyle(SizeType.Absolute, 50F));
tableKeys.RowStyles.Add(new RowStyle(SizeType.Absolute, 50F));
tableKeys.Size = new Size(897, 266);
tableKeys.RowStyles.Add(new RowStyle(SizeType.Absolute, 48F));
tableKeys.RowStyles.Add(new RowStyle(SizeType.Absolute, 22F));
tableKeys.Size = new Size(897, 318);
tableKeys.TabIndex = 10;
//
// textM2
@@ -305,7 +312,7 @@ namespace GHelper
groupLight.Controls.Add(panelXMG);
groupLight.Controls.Add(tableBacklight);
groupLight.Dock = DockStyle.Top;
groupLight.Location = new Point(10, 334);
groupLight.Location = new Point(10, 386);
groupLight.Name = "groupLight";
groupLight.Size = new Size(954, 563);
groupLight.TabIndex = 1;
@@ -693,7 +700,7 @@ namespace GHelper
groupOther.Controls.Add(checkNoOverdrive);
groupOther.Controls.Add(checkTopmost);
groupOther.Dock = DockStyle.Top;
groupOther.Location = new Point(10, 897);
groupOther.Location = new Point(10, 949);
groupOther.Name = "groupOther";
groupOther.Size = new Size(954, 352);
groupOther.TabIndex = 2;
@@ -772,6 +779,33 @@ namespace GHelper
checkTopmost.Text = Strings.WindowTop;
checkTopmost.UseVisualStyleBackColor = true;
//
// labelFNC
//
labelFNC.AutoSize = true;
labelFNC.Location = new Point(13, 258);
labelFNC.Name = "labelFNC";
labelFNC.Size = new Size(80, 32);
labelFNC.TabIndex = 15;
labelFNC.Text = "FN+C:";
//
// comboFNC
//
comboFNC.BorderColor = Color.White;
comboFNC.ButtonColor = Color.FromArgb(255, 255, 255);
comboFNC.FormattingEnabled = true;
comboFNC.Location = new Point(188, 261);
comboFNC.Name = "comboFNC";
comboFNC.Size = new Size(312, 40);
comboFNC.TabIndex = 16;
//
// textFNC
//
textFNC.Location = new Point(538, 261);
textFNC.Name = "textFNC";
textFNC.PlaceholderText = "action";
textFNC.Size = new Size(346, 39);
textFNC.TabIndex = 17;
//
// Extra
//
AutoScaleDimensions = new SizeF(13F, 32F);
@@ -873,5 +907,8 @@ namespace GHelper
private Label labelBacklightTimeoutPlugged;
private CheckBox checkGpuApps;
private CheckBox checkFnLock;
private Label labelFNC;
private RComboBox comboFNC;
private TextBox textFNC;
}
}

View File

@@ -17,6 +17,7 @@ namespace GHelper
{"performance", Properties.Strings.PerformanceMode},
{"screen", Properties.Strings.ToggleScreen},
{"miniled", Properties.Strings.ToggleMiniled},
{"fnlock", Properties.Strings.ToggleFnLock},
{"custom", Properties.Strings.Custom}
};
@@ -41,6 +42,10 @@ namespace GHelper
customActions[""] = Properties.Strings.ToggleAura;
customActions.Remove("aura");
break;
case "fnc":
customActions[""] = Properties.Strings.ToggleFnLock;
customActions.Remove("fnlock");
break;
}
combo.DropDownStyle = ComboBoxStyle.DropDownList;
@@ -112,6 +117,7 @@ namespace GHelper
SetKeyCombo(comboM3, textM3, "m3");
SetKeyCombo(comboM4, textM4, "m4");
SetKeyCombo(comboFNF4, textFNF4, "fnf4");
SetKeyCombo(comboFNC, textFNC, "fnc");
Shown += Keyboard_Shown;

View File

@@ -199,6 +199,22 @@ namespace GHelper
}
}
if (AppConfig.ContainsModel("GA401I"))
{
switch (e.Key)
{
case Keys.F2:
KeyboardHook.KeyPress(Keys.MediaPreviousTrack);
return;
case Keys.F3:
KeyboardHook.KeyPress(Keys.MediaPlayPause);
return;
case Keys.F4:
KeyboardHook.KeyPress(Keys.MediaNextTrack);
return;
}
}
switch (e.Key)
{
@@ -277,6 +293,8 @@ namespace GHelper
action = "performance";
if (name == "m3" && !OptimizationService.IsRunning())
action = "micmute";
if (name == "fnc")
action = "fnlock";
}
switch (action)
@@ -308,8 +326,8 @@ namespace GHelper
Program.SettingsToggle();
});
break;
case "custom":
CustomKey(name);
case "fnlock":
ToggleFnLock();
break;
case "micmute":
using (var enumerator = new MMDeviceEnumerator())
@@ -320,6 +338,9 @@ namespace GHelper
Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, muteStatus ? "Muted" : "Unmuted", muteStatus ? ToastIcon.MicrophoneMute : ToastIcon.Microphone);
}
break;
case "custom":
CustomKey(name);
break;
default:
break;
@@ -338,7 +359,13 @@ namespace GHelper
{
int fnLock = AppConfig.isConfig("fn_lock") ? 0 : 1;
AppConfig.setConfig("fn_lock", fnLock);
if (AppConfig.ContainsModel("VivoBook"))
Program.acpi.DeviceSet(AsusACPI.FnLock, (fnLock == 1) ? 0 : 1, "FnLock");
else
Program.settingsForm.BeginInvoke(Program.inputDispatcher.RegisterKeys);
Program.settingsForm.BeginInvoke(Program.settingsForm.RunToast, "Fn-Lock "+(fnLock==1?"On":"Off"), ToastIcon.FnLock);
}
static void TabletMode()
@@ -369,12 +396,15 @@ namespace GHelper
case 178: // FN+F4
KeyProcess("fnf4");
return;
case 189: // Tablet mode
TabletMode();
case 158: // Fn + C
KeyProcess("fnc");
return;
case 78: // Fn + ESC
ToggleFnLock();
return;
case 189: // Tablet mode
TabletMode();
return;
}
if (!OptimizationService.IsRunning()) OptimizationEvent(EventID);

View File

@@ -180,6 +180,16 @@ namespace GHelper.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_function {
get {
object obj = ResourceManager.GetObject("icons8_function", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View File

@@ -232,4 +232,7 @@
<data name="icons8_mute_unmute_96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-mute-unmute-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8_function" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-function-mac-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@@ -1023,6 +1023,15 @@ namespace GHelper.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Toggle Fn-Lock.
/// </summary>
internal static string ToggleFnLock {
get {
return ResourceManager.GetString("ToggleFnLock", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Toggle Miniled (if supported).
/// </summary>

View File

@@ -438,6 +438,9 @@
<data name="ToggleAura" xml:space="preserve">
<value>Toggle Aura</value>
</data>
<data name="ToggleFnLock" xml:space="preserve">
<value>Toggle Fn-Lock</value>
</data>
<data name="ToggleMiniled" xml:space="preserve">
<value>Toggle Miniled (if supported)</value>
</data>

View File

@@ -266,6 +266,9 @@
</data>
<data name="FansPower" xml:space="preserve">
<value>自定義設置</value>
</data>
<data name="FnLock" xml:space="preserve">
<value>使用Fn+F1~F12的功能時不須按下Fn鍵</value>
</data>
<data name="GPUBoost" xml:space="preserve">
<value>Dynamic Boost</value>
@@ -308,6 +311,9 @@
</data>
<data name="LaptopBacklight" xml:space="preserve">
<value>背光</value>
</data>
<data name="KillGpuApps" xml:space="preserve">
<value>切換至節能模式時,關閉所有正在使用獨顯的程式</value>
</data>
<data name="LaptopKeyboard" xml:space="preserve">
<value>鍵盤背光:</value>

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

View File

@@ -51,7 +51,8 @@ namespace GHelper
BacklightDown,
Touchpad,
Microphone,
MicrophoneMute
MicrophoneMute,
FnLock
}
public class ToastForm : OSDNativeForm
@@ -103,6 +104,9 @@ namespace GHelper
case ToastIcon.Touchpad:
icon = Properties.Resources.icons8_touchpad_96;
break;
case ToastIcon.FnLock:
icon = Properties.Resources.icons8_function;
break;
}