15

1. Briefly

I want to disable only some Windows 10 default global hotkeys, to use this hotkeys for run Sublime Text commands.



2. Detail

I have Windows 32-bit 10.0.14393. In Windows 10 we have many native hotkeys.

1. I want to disable

For example, I want to disable custom hotkeys, Win+K, Win+H and Ctrl+Win+P.

2. I don't want to disable

But, for example, I don't want to disable Win+D and Win+R hotkeys. I often use these hotkeys.

3. Sublime Text keymap part

{
    "keys": ["super+k"],
    "command": "paste"
},


3. Did not help

1. AutoHotkey Override

My code:

#k::return

Win+K global hotkey is disabled for me, but my Sublime Text command paste doesn't run too.

2. AutoHotkey overwrite global Windows hotkeys to hotkey of application

My code:

#IfWinActive ahk_class PX_WINDOW_CLASS
$#2::ControlSend, ahk_parent, % SubStr(A_ThisHotkey, 2)
#IfWinActive

It is worked for me, but I have bugs, for example:

AutoHotkey bug

For other hotkeys I have bugs too. It would be nice if someone will improve this code.

3. SharpKeys

SharpKeys program can disable or reassign Win key, but I don't want this.

4. gpedit.msc

I can disable some default hotkeys, but:

  • I can not disable (using gpedit.msc), for example, Win+K, Win+H and Ctrl+Win+P.
  • I can disable Win+D and Win+R, but I want to use this hotkeys.

5. Simple disable key

I download Simple disable key → I disable Win+K in program → I restart Windows → Win+K is not disabled for me.

6. DisabledHotkeys parameter in Windows Registry

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced]

I create string parameter DisableHotkeys with value KHPE.

DisabledHotkeys

Win+E, for example, is disabled for me, but

  • Win+P, Win+K and Win+H are not disabled.
  • This method is not for disabling, for example, Ctrl+Win+P and Ctrl+Win+F4.


4. Do not offer

0

4 Answers 4

3

You could use Autohotkey for remap any hotkey to send another hotkey using Send command:

#k::
Send {WIN up}
Send {k up}
Send ^+p
return

After this pressing Win+K will send a Ctrl+Shift+P which will show Command Palette in Sublime Text, you can use this way to override any hotkey to send another hotkey, set it to something like Ctrl+Shift+F3 and assign that hotkey to Sublime Text's paste(in keybindings) and then use Win+K to send that Ctrl+Shift+F3 to Sublime Text which will call paste.

AutoHotkey script:

#k::
Send {WIN up}
Send {K up}
Send !^+{F3}
return

Sublime Text keybindings:

{ "keys": ["ctrl+alt+shift+f3"], "command": "paste" }

Edit:

Seen your Please, don't offer AutoHotkey shortcuts redirect to other shortcuts. why not? Above example works even for Win+R:

#r::
Send {WIN up}
Send {r up}
Send !^+{F3}
return

Text successfully pasted through Win+R in Sublime Text.

Edit 2:

If you really like to assign real hotkeys you could disable all Win+{KEY} hotkeys, and then create your hotkeys which will do same as default Win+{Key} hotkeys, and for another hotkeys assign your own actions.

For example for Win+R:

explorer.exe Shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0}

Works, but for some hotkey its hard to find how to call their actions.

5
  • BladeMight, // 1) > Seen your Please, don't offer AutoHotkey shortcuts redirect to other shortcuts. why not? — Create another shortcut if I also have shortcut meaningless. Why we need additional shortcut Win+K, if we have Ctrl+V? But I have not thought, I forgot that we can change long uncomfortable hotkeys, which we don't use. Win+K is more comfortable then Ctrl+Win+Alt+Shift+F3. Thanks for solution! Jan 21, 2017 at 4:14
  • // 2) you could disable all Win+{KEY} hotkeys, — it is similar like VoidVolker solution? And how I can find digits like {2559a1f3-21d7-11d4-bdaf-00c04f60b9f0} for hotkeys? Thanks. Jan 21, 2017 at 4:22
  • BladeMight, please, add return after each your script. Otherwise, if I use many scripts in one .ahk file, all scripts run for me. Thanks. Jan 29, 2017 at 12:03
  • 1
    @СашаЧерных About Shell::: here is a list of g-ek.com/clsid-guid-spisok-shell-v-windows-10 but that mainly for folders.
    – BladeMight
    Jan 29, 2017 at 16:47
  • 1
    @СашаЧерных also here ipmnet.ru/~sadilina/Windows/227.html may be helpful.
    – BladeMight
    Jan 29, 2017 at 16:53
2

I also searched for a way to prevent Windows 10 from opening it's own Clipboard when pressing Win+V because I want to assign Ditto to it. I finally got it working in Win10 (20H2).

To free Win+V (and probably other hotkeys too)

  1. Open regedit

  2. Navigate to the key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced

  3. Right-click and select New > Expandable String Value from the context menu. (this is essential as the normal "string value" doesn't work)

  4. Name it DisabledHotkeys

  5. Add the character of the hotkey(s) you want to release. In my case I simply added V to the value. see screenshot

  1. Log out (via Startmenu) and back in

Now I could assing Win + V to Ditto without getting an error message.

2
  • 1
    How does this differ from the similar answer that was submitted 4 year ago?
    – Ramhound
    Sep 29, 2020 at 22:02
  • I guess it‘s the „Expandable String Value“ what makes the difference. Else it didn‘t work for me on Win10 (20H2).
    – J4ZZ
    Oct 2, 2020 at 14:43
1

Should explicit shortcut scope, especially who should handle the shortcut.

For general propose - in program A, disable global shortkey handled by program B, enable it to be handled by C (or A itself).

  1. Use AHK(autohotkey) - program D, regist this shortkey as global by physical in context A.

  2. Then use Send to re-send simulated shortcut to active window, as if there isn't any global shortcut.
    Or use ControlSend to redirect to special window C, as if C handle this shortcut globally.

IfWinActive ahk_exe notepad.exe
$#q::#q ;this will block #q from windows when in notepad.exe
;or
;  $#q::ControlSend ,,#q,ahk_exe C.exe  ;assume C could hanlde #q globally
#If
1
  • Thank you so much, you saved my day, that goddamn Webex was stealing shortcuts from Intellij by replacing them globally, now I could finally fix it with resending the same shortcut to Intellij instead of Webex. #IfWinActive, ahk_exe idea64.exe { ^+z::ControlSend ,,^+z, ahk_exe idea64.exe ^+d::ControlSend ,,^+d, ahk_exe idea64.exe } Sep 6, 2021 at 11:38
0

Take a look at the DisabledHotkeys registry value, applied in this branch:

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced

Setting it's value data to KHP would block WinKey + K, WinKey + H and WinKey + P combinations.

Src: DisabledHotkeys registry value

3
  • w32sh, I set DisableHotkeys parameter → I restart Windows → Win+P, Win+K and Win+H global shortcuts run for me like before( . Thanks. Nov 19, 2016 at 12:15
  • Just tested it here. It doesn't seem to work for P H and K. It's able to block WinKey + E though. I'd like to delete my answer.
    – w32sh
    Nov 19, 2016 at 12:24
  • 1
    w32sh, I tested on other hotkeys now. It's able to block only hotkeys like in gpedit.msc. Thanks. Nov 19, 2016 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.