diff --git a/src/modules/alwaysontop/AlwaysOnTopModuleInterface/ModuleInterface.cs b/src/modules/alwaysontop/AlwaysOnTopModuleInterface/ModuleInterface.cs index a4c26035c9..f00ab2d4c6 100644 --- a/src/modules/alwaysontop/AlwaysOnTopModuleInterface/ModuleInterface.cs +++ b/src/modules/alwaysontop/AlwaysOnTopModuleInterface/ModuleInterface.cs @@ -18,7 +18,7 @@ namespace AlwaysOnTopModuleInterface public string Name => "AlwaysOnTop"; - public GpoRuleConfigured GpoRuleConfigured => GpoRuleConfigured.Unavailable; + public GpoRuleConfigured GpoRuleConfigured => GPOWrapper.GetConfiguredAlwaysOnTopEnabledValue(); private Process? _process; @@ -48,7 +48,7 @@ namespace AlwaysOnTopModuleInterface _process = Process.Start(psi); } - public HotkeyEx HotkeyEx => new(0x2 | 0x1, 0x54); // Ctrl + Alt + T + public HotkeyEx HotkeyEx => new SettingsUtils().GetSettings().Properties.Hotkey.Value; public Action OnHotkey => () => { diff --git a/src/settings-ui/Settings.UI.Library/HotkeySettings.cs b/src/settings-ui/Settings.UI.Library/HotkeySettings.cs index b5fa41fcf6..29e0b98b4f 100644 --- a/src/settings-ui/Settings.UI.Library/HotkeySettings.cs +++ b/src/settings-ui/Settings.UI.Library/HotkeySettings.cs @@ -316,5 +316,31 @@ namespace Microsoft.PowerToys.Settings.UI.Library result = result.Replace(" ", null); return true; } + + public static implicit operator HotkeyEx(HotkeySettings settings) + { + ushort modifiers = 0; + if (settings.Ctrl) + { + modifiers += 0x0002; + } + + if (settings.Alt) + { + modifiers += 0x0001; + } + + if (settings.Shift) + { + modifiers += 0x0004; + } + + if (settings.Win) + { + modifiers += 0x0008; + } + + return new HotkeyEx(modifiers, (ushort)settings.Code); + } } }