diff --git a/app/Extra.Designer.cs b/app/Extra.Designer.cs index f2beec71..4304c3d2 100644 --- a/app/Extra.Designer.cs +++ b/app/Extra.Designer.cs @@ -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; } } \ No newline at end of file diff --git a/app/Extra.cs b/app/Extra.cs index 91655d70..02cf1558 100644 --- a/app/Extra.cs +++ b/app/Extra.cs @@ -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; diff --git a/app/InputDispatcher.cs b/app/InputDispatcher.cs index 43d25175..b2dc1752 100644 --- a/app/InputDispatcher.cs +++ b/app/InputDispatcher.cs @@ -198,8 +198,24 @@ namespace GHelper return; } } - - + + 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) { case Keys.F1: @@ -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); - Program.acpi.DeviceSet(AsusACPI.FnLock, (fnLock == 1) ? 0 : 1, "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); diff --git a/app/Properties/Resources.Designer.cs b/app/Properties/Resources.Designer.cs index 31155903..66570f4a 100644 --- a/app/Properties/Resources.Designer.cs +++ b/app/Properties/Resources.Designer.cs @@ -180,6 +180,16 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_function { + get { + object obj = ResourceManager.GetObject("icons8_function", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/app/Properties/Resources.resx b/app/Properties/Resources.resx index 57f3f6d6..2eca7afa 100644 --- a/app/Properties/Resources.resx +++ b/app/Properties/Resources.resx @@ -232,4 +232,7 @@ ..\Resources\icons8-mute-unmute-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icons8-function-mac-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/app/Properties/Strings.Designer.cs b/app/Properties/Strings.Designer.cs index fcf86b27..deb9a462 100644 --- a/app/Properties/Strings.Designer.cs +++ b/app/Properties/Strings.Designer.cs @@ -1023,6 +1023,15 @@ namespace GHelper.Properties { } } + /// + /// Looks up a localized string similar to Toggle Fn-Lock. + /// + internal static string ToggleFnLock { + get { + return ResourceManager.GetString("ToggleFnLock", resourceCulture); + } + } + /// /// Looks up a localized string similar to Toggle Miniled (if supported). /// diff --git a/app/Properties/Strings.resx b/app/Properties/Strings.resx index 9d3582ec..3b54d187 100644 --- a/app/Properties/Strings.resx +++ b/app/Properties/Strings.resx @@ -438,6 +438,9 @@ Toggle Aura + + Toggle Fn-Lock + Toggle Miniled (if supported) diff --git a/app/Properties/Strings.zh-TW.resx b/app/Properties/Strings.zh-TW.resx index e0fc51ff..0bb71714 100644 --- a/app/Properties/Strings.zh-TW.resx +++ b/app/Properties/Strings.zh-TW.resx @@ -266,6 +266,9 @@ 自定義設置 + + + 使用Fn+F1~F12的功能時不須按下Fn鍵 Dynamic Boost @@ -308,6 +311,9 @@ 背光 + + + 切換至節能模式時,關閉所有正在使用獨顯的程式 鍵盤背光: diff --git a/app/Resources/icons8-function-mac-96.png b/app/Resources/icons8-function-mac-96.png new file mode 100644 index 00000000..ff5333c7 Binary files /dev/null and b/app/Resources/icons8-function-mac-96.png differ diff --git a/app/ToastForm.cs b/app/ToastForm.cs index 3c8a240c..d8b38d7b 100644 --- a/app/ToastForm.cs +++ b/app/ToastForm.cs @@ -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; }