Swap left CTRL with left WIN in Win 11 - sometimes stuck
Posted: 29 Apr 2024, 08:24
Hi,
I'm using mac layout keyboard. I really hate using my pinky finger for control so I prefer using my thumb.
I'd like to simply switch both keys.
Right now I have this script which mosty works. Mostly.
However, it is quite usual that it "gets stuck" so that windows key appears to be "sticky pressed" (sticky feature is OFF in my windows); when I press numbers on my keyboard like 1 it would bring up corresponding tools.
To make it unstuck I need to randomly hit windows and control... not exactly sure how it gets stuck on unstuck.
This is super annoying. Could someone please help me with the right script?
I am using windows 11.
[Mod edit: Moved from 'Scripts and Functions (v1)' since this is a help request.]
I'm using mac layout keyboard. I really hate using my pinky finger for control so I prefer using my thumb.
I'd like to simply switch both keys.
Right now I have this script which mosty works. Mostly.
Code: Select all
;OPTIMIZATIONS START
#NoEnv
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
ListLines Off
Process, Priority, , A
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1
SetControlDelay, -1
SendMode Input
DllCall("ntdll\ZwSetTimerResolution","Int",5000,"Int",1,"Int*",MyCurrentTimerResolution) ;setting the Windows Timer Resolution to 0.5ms, THIS IS A GLOBAL CHANGE
;OPTIMIZATIONS END
if not A_IsAdmin
{
Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
ExitApp
}
LWin::LCtrl
LCtrl::LWin
RWin::RAlt
!`::
WinGet, ActiveProcessName, ProcessName, A
WinGet, WinClassCount, List, ahk_exe %ActiveProcessName%
if (WinClassCount = 1)
return
if (NextWindow = "")
NextWindow := 2
element := % WinClassCount%NextWindow%
WinSet, Top,, ahk_id %element%
WinActivate, ahk_id %element%
NextWindow += 1
if (NextWindow > WinClassCount || !getKeyState("Alt"))
NextWindow := 2
return
; Google Search select text - Ctrl + Shift + G
^+g::
{
Send, ^c
Sleep 50
Run, http://www.google.com/search?q=%clipboard%
Return
}
return
; ADO Search select text - Ctrl + Shift + A
^+a::
{
Send, ^c
Sleep 50
Run, https://dev.azure.com/mseng/AzureDevOps/_search?text=%clipboard%
Return
}
return
To make it unstuck I need to randomly hit windows and control... not exactly sure how it gets stuck on unstuck.
This is super annoying. Could someone please help me with the right script?
I am using windows 11.
[Mod edit: Moved from 'Scripts and Functions (v1)' since this is a help request.]