Skip to content

Instantly share code, notes, and snippets.

@deluxghost
Last active July 29, 2019 04:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deluxghost/41b90ac8c22e92403e3ce93e58fdea98 to your computer and use it in GitHub Desktop.
Save deluxghost/41b90ac8c22e92403e3ce93e58fdea98 to your computer and use it in GitHub Desktop.
Windows AHK Tweak
#Persistent
#InstallKeybdHook
#SingleInstance force
SetWorkingDir %A_ScriptDir%
CoordMode, Mouse, Screen
SetTitleMatchMode, 3
DetectHiddenWindows, On
SetTimer, NoExtWarning, 50
return
MouseIsOver(WinTitle) {
MouseGetPos,,, Win
return WinExist(WinTitle . " ahk_id " . Win)
}
; Gets a localized string from a resource file
TranslateMUI(resDll, resID) {
VarSetCapacity(buf, 256)
hDll := DllCall("LoadLibrary", "str",resDll, "Ptr")
Result := DllCall("LoadString", "Ptr",hDll, "Uint",resID, "str",buf, "int",128)
return buf
}
; Skip "change a filename extension" dialog
NoExtWarning:
if WinExist(TranslateMUI("shell32.dll", 4148) . " ahk_class #32770") {
SetControlDelay -1
ControlClick, Button1, % TranslateMUI("shell32.dll", 4148) . " ahk_class #32770",,,, NA
}
return
; Capslock key change IME mode, long press to caps lock
Capslock::
if GetKeyState("CapsLock", "T") == 1 {
SetCapsLockState, Off
return
}
KeyWait, Capslock, T0.25
if ErrorLevel {
SetCapsLockState, On
KeyWait, Capslock
} else {
; Ctrl-Space
Send, ^{space}
}
return
; Disable Numlock key
~NumLock::
SetNumlockState, On
return
; Win-m to move window (not compatible with some windows)
#m::
; Alt-Space
Send, !{Space}
Sleep, 5
Send, m
Sleep, 5
Send, {Left}{Right}
return
; Win-z to minimize window
#If not WinActive("ahk_class WorkerW")
#z::
WinGet, active_id, ID, A
WinMinimize, ahk_id %active_id%
return
#If
; Win-s to Always-on-Top
#If not WinActive("ahk_class WorkerW") and not WinActive("ahk_class Shell_TrayWnd")
#s::
Winset, Alwaysontop,, A
return
#If
; Scroll mouse wheel on taskbar to change system volume
#If MouseIsOver("ahk_class Shell_TrayWnd")
WheelUp::
Send, {Volume_Up}
Sleep, 100
return
WheelDown::
Send, {Volume_Down}
Sleep, 100
return
#If
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment