Skip to content

Instantly share code, notes, and snippets.

@hetima
Last active December 20, 2021 14:14
Show Gist options
  • Save hetima/ad0eacfdc68cc78a2fc1d507d8bea43e to your computer and use it in GitHub Desktop.
Save hetima/ad0eacfdc68cc78a2fc1d507d8bea43e to your computer and use it in GitHub Desktop.
マウスポインタの場所にあるウィンドウを前面に持ってくるahk
; マウスポインタの場所にあるウィンドウを前面に持ってくる
selectWindowUnderMouse(){
MouseGetPos,x,y,hwnd
WinGetClass win_cls, ahk_id %hwnd%
if win_cls = WorkerW
{
; デスクトップではエクスプローラのウィンドウを表示orサイクル
WinGetClass, front_win, A
if front_win = CabinetWClass
{
WinActivateBottom ahk_class CabinetWClass
} else {
WinActivate ahk_class CabinetWClass
}
return True
}
else if win_cls = Shell_TrayWnd
{
; タスクバー 何するか考え中
; 前面2枚のウィンドウを交互に切り替え案
Send,!{Tab}
return True
}
IfWinActive, ahk_id %hwnd%
{
return False
}
WinActivate ahk_id %hwnd%
return True
}
; ホイールを回すとウィンドウ切り替え
~WheelUp::
selectWindowUnderMouse()
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment