mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
CmdPal: Apply the LLKH to all command hotkeys (#39524)
<!-- Let's say you wanted to add a hotkey to the Run command. And let's say you wanted it to be Win+R. This lets you do that --> We should apply the LLKH setting to all command hotkeys, not just the global one.
This commit is contained in:
@@ -496,18 +496,27 @@ public sealed partial class MainWindow : WindowEx,
|
|||||||
|
|
||||||
if (key != null)
|
if (key != null)
|
||||||
{
|
{
|
||||||
var vk = key.Code;
|
if (settings.UseLowLevelGlobalHotkey)
|
||||||
var modifiers =
|
|
||||||
(key.Alt ? HOT_KEY_MODIFIERS.MOD_ALT : 0) |
|
|
||||||
(key.Ctrl ? HOT_KEY_MODIFIERS.MOD_CONTROL : 0) |
|
|
||||||
(key.Shift ? HOT_KEY_MODIFIERS.MOD_SHIFT : 0) |
|
|
||||||
(key.Win ? HOT_KEY_MODIFIERS.MOD_WIN : 0)
|
|
||||||
;
|
|
||||||
|
|
||||||
var success = PInvoke.RegisterHotKey(_hwnd, _hotkeys.Count, modifiers, (uint)vk);
|
|
||||||
if (success)
|
|
||||||
{
|
{
|
||||||
_hotkeys.Add(commandHotkey);
|
_keyboardListener.SetHotkeyAction(key.Win, key.Ctrl, key.Shift, key.Alt, (byte)key.Code, commandHotkey.CommandId);
|
||||||
|
|
||||||
|
_hotkeys.Add(new(globalHotkey, string.Empty));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var vk = key.Code;
|
||||||
|
var modifiers =
|
||||||
|
(key.Alt ? HOT_KEY_MODIFIERS.MOD_ALT : 0) |
|
||||||
|
(key.Ctrl ? HOT_KEY_MODIFIERS.MOD_CONTROL : 0) |
|
||||||
|
(key.Shift ? HOT_KEY_MODIFIERS.MOD_SHIFT : 0) |
|
||||||
|
(key.Win ? HOT_KEY_MODIFIERS.MOD_WIN : 0)
|
||||||
|
;
|
||||||
|
|
||||||
|
var success = PInvoke.RegisterHotKey(_hwnd, _hotkeys.Count, modifiers, (uint)vk);
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
_hotkeys.Add(commandHotkey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user