Adapt Always on Top module to use right settings and GPO

This commit is contained in:
Noraa Junker
2025-11-19 14:52:37 +01:00
parent 2ddf561f57
commit d1564b0572
2 changed files with 28 additions and 2 deletions

View File

@@ -18,7 +18,7 @@ namespace AlwaysOnTopModuleInterface
public string Name => "AlwaysOnTop"; public string Name => "AlwaysOnTop";
public GpoRuleConfigured GpoRuleConfigured => GpoRuleConfigured.Unavailable; public GpoRuleConfigured GpoRuleConfigured => GPOWrapper.GetConfiguredAlwaysOnTopEnabledValue();
private Process? _process; private Process? _process;
@@ -48,7 +48,7 @@ namespace AlwaysOnTopModuleInterface
_process = Process.Start(psi); _process = Process.Start(psi);
} }
public HotkeyEx HotkeyEx => new(0x2 | 0x1, 0x54); // Ctrl + Alt + T public HotkeyEx HotkeyEx => new SettingsUtils().GetSettings<AlwaysOnTopSettings>().Properties.Hotkey.Value;
public Action OnHotkey => () => public Action OnHotkey => () =>
{ {

View File

@@ -316,5 +316,31 @@ namespace Microsoft.PowerToys.Settings.UI.Library
result = result.Replace(" ", null); result = result.Replace(" ", null);
return true; 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);
}
} }
} }