Override default windows hotkeys

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
afshindavoudy
Posts: 44
Joined: 10 Jan 2024, 13:25

Override default windows hotkeys

Post by afshindavoudy » 14 Feb 2024, 06:48

How to override some default windows hotkeys?
I can override #r easily, by #r:: soundbeep or Lwin & r:: soundbeep
but can't override #g or #l in the same way. These hotkeys don't prevent default actions which are opening xbox gamebar and lock system.

User avatar
Seven0528
Posts: 412
Joined: 23 Jan 2023, 04:52
Location: South Korea
Contact:

Re: Override default windows hotkeys

Post by Seven0528 » 14 Feb 2024, 07:02

 Surely there should be relevant information in the official documentation...
but I can't seem to find it. As far as I know, remapping some hotkeys in Windows can be challenging or even impossible.
The easiest example to illustrate this would be Ctrl + Alt + Delete, which is protected at the system level, making it difficult to remap.

:dance:
However, it doesn't mean there is no way at all. Consider the following two methods:
1. Overriding or Disabling External Hotkeys
https://www.autohotkey.com/docs/v2/misc/Override.htm
2. AutoHotInterception
https://github.com/evilC/AutoHotInterception
  • English is not my native language. Please forgive any awkward expressions.
  • 영어는 제 모국어가 아닙니다. 어색한 표현이 있어도 양해해 주세요.

User avatar
xMaxrayx
Posts: 237
Joined: 06 Dec 2022, 02:56
Contact:

Re: Override default windows hotkeys

Post by xMaxrayx » 14 Feb 2024, 10:20

as @Seven0528 what's said.

additionally you can disable windows keys in registry or policy editor

win+g can be disabled in sittings
-----------------------ヾ(•ω•`)o------------------------------
https://github.com/xmaxrayx/

afshindavoudy
Posts: 44
Joined: 10 Jan 2024, 13:25

Re: Override default windows hotkeys

Post by afshindavoudy » 16 Feb 2024, 23:50

@Seven0528
@xMaxrayx
Thank you both for reply.

I didn't want to disable all Win keys.
So, I just disabled Win+l using this guide: https://superuser.com/questions/1059511/how-to-disable-winl-in-windows-10
and removed Game-bar using the following command in PowerShell (Admin):

Get-AppxPackage Microsoft.XboxGamingOverlay | Remove-AppxPackage

User avatar
xMaxrayx
Posts: 237
Joined: 06 Dec 2022, 02:56
Contact:

Re: Override default windows hotkeys

Post by xMaxrayx » 04 Mar 2024, 11:28

@afshindavoudy


nice works, you can disable them in sittings in case windows update bring them back.
-----------------------ヾ(•ω•`)o------------------------------
https://github.com/xmaxrayx/

riyah96662
Posts: 7
Joined: 17 Mar 2024, 14:04

Re: Override default windows hotkeys

Post by riyah96662 » 21 Mar 2024, 17:27

Code: Select all

*LWin::KeyWait "LWin"
~*LWin up::return
Here is another way to disable Win hotkeys except for Win+L.
You can disable Game Bar hotkeys without removing it, making it more portable.
Unfortunately you still have to edit the registry to disable Win+L.
I do not disable Win+L, so this is good enough for me.
If you want to keep some of the hotkeys you have to remap them explicitly.

Code: Select all

LWin & 1::Send "{Blind}#1"
LWin & a::Send "#a"
LWin & Tab::Send "#{Tab}"
Note that it has to be LWin & instead of <#, otherwise the hotkeys would not work.

Bonus: Show Start Menu only when shortly pressed alone.

Code: Select all

*LWin::KeyWait "LWin"
~*LWin up::GetKeyState("Shift","P") || GetKeyState("Ctrl","P") || GetKeyState("Alt","P") || "*" A_PriorKey=A_PriorHotkey && A_TimeSincePriorHotkey<200 && Send("{LWin}")
The thresholds is 200ms.
It only shows Start Menu only if pressed less than 200ms.
You can change the number as you want or just remove the condition if you do not need it.

Post Reply

Return to “Ask for Help (v2)”