Created
September 4, 2021 13:42
-
-
Save nmsobri/856aeb66653679762f5058ad87147482 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;Grouping for disable always on top | |
GroupAdd, uniqueOnTop, ahk_exe WindowsTerminal.exe | |
GroupAdd, uniqueOnTop, ahk_exe Code.exe | |
GroupAdd, uniqueOnTop, ahk_exe idea64.exe | |
GroupAdd, uniqueOnTop, ahk_exe mintty.exe | |
#Persistent ; Keeps script running persisitantly | |
SetTimer, HotCorners, 0 ; HotCorners is name of timer, will be reset every 0 seconds until process is killed | |
return | |
HotCorners: ; Timer content | |
CoordMode, Mouse, Screen ; Coordinate mode - coords will be passed to mouse related functions, with coords relative to entire screen | |
IsCorner(cornerID) | |
{ | |
WinGetPos, X, Y, Xmax, Ymax, Program Manager ; get desktop size | |
MouseGetPos, MouseX, MouseY ; Function MouseGetPos retrieves the current position of the mouse cursor | |
T = 5 ; adjust tolerance value (pixels to corner) if desired | |
CornerTopLeft := (MouseY < T and MouseX < T) ; Boolean stores whether mouse cursor is in top left corner | |
CornerTopRight := (MouseY < T and MouseX > Xmax - T) ; Boolean stores whether mouse cursor is in top right corner | |
CornerBottomLeft := (MouseY > Ymax - T and MouseX < T) ; Boolean stores whether mouse cursor is in bottom left corner | |
CornerBottomRight := (MouseY > Ymax - T and MouseX > Xmax - T) ; Boolean stores whether mouse cursor is in top left corner | |
if (cornerID = "TopLeft"){ | |
return CornerTopLeft | |
} | |
else if (cornerID = "TopRight"){ | |
return CornerTopRight | |
} | |
else if (cornerID = "BottomLeft"){ | |
return CornerBottomLeft | |
} | |
else if (cornerID = "BottomRight") { | |
return CornerBottomRight | |
} | |
} | |
; Show Task View (Open Apps Overview) | |
if IsCorner("TopLeft") | |
{ | |
Send, {LWin down}{tab down} | |
Send, {LWin up}{tab up} | |
Loop | |
{ | |
if ! IsCorner("TopLeft") | |
break ; exits loop when mouse is no longer in the corner | |
} | |
} | |
; Show Action Center | |
;if IsCorner("TopRight") | |
;{ | |
; Send, {LWin down}{a down} | |
; Send, {LWin up}{a up} | |
; Loop | |
; { | |
; if ! IsCorner("TopRight") | |
; break ; exits loop when mouse is no longer in the corner | |
; } | |
;} | |
; Press Windows | |
if IsCorner("BottomLeft") | |
{ | |
Send, {LWin down} | |
Send, {LWin up} | |
Loop | |
{ | |
if ! IsCorner("BottomLeft") | |
break ; exits loop when mouse is no longer in the corner | |
} | |
} | |
;^+Enter:: HideShowTaskbar(hide := !hide) ;Hide Taskbar -> Ctrl+Shift+Enter | |
;HideShowTaskbar(action) { | |
; static ABM_SETSTATE := 0xA, ABS_AUTOHIDE := 0x1, ABS_ALWAYSONTOP := 0x2 | |
; VarSetCapacity(APPBARDATA, size := 2*A_PtrSize + 2*4 + 16 + A_PtrSize, 0) | |
; NumPut(size, APPBARDATA), NumPut(WinExist("ahk_class Shell_TrayWnd"), APPBARDATA, A_PtrSize) | |
; NumPut(action ? ABS_AUTOHIDE : ABS_ALWAYSONTOP, APPBARDATA, size - A_PtrSize) | |
; DllCall("Shell32\SHAppBarMessage", UInt, ABM_SETSTATE, Ptr, &APPBARDATA) | |
;} | |
^+Enter:: HideShowTaskbars() ;Hide Taskbar -> Ctrl+Shift+Enter | |
HideShowTaskbars() { | |
static SW_HIDE := 0, SW_SHOWNA := 8, SPI_SETWORKAREA := 0x2F | |
DetectHiddenWindows, On | |
hTB := WinExist("ahk_class Shell_TrayWnd") | |
WinGetPos,,,, H | |
hBT := WinExist("ahk_class Button ahk_exe Explorer.EXE") ; for Windows 7 | |
b := DllCall("IsWindowVisible", "Ptr", hTB) | |
for k, v in [hTB, hBT] | |
( v && DllCall("ShowWindow", "Ptr", v, "Int", b ? SW_HIDE : SW_SHOWNA) ) | |
VarSetCapacity(RECT, 16, 0) | |
NumPut(A_ScreenWidth, RECT, 8) | |
NumPut(A_ScreenHeight - !b*H, RECT, 12, "UInt") | |
DllCall("SystemParametersInfo", "UInt", SPI_SETWORKAREA, "UInt", 0, "Ptr", &RECT, "UInt", 0) | |
WinGet, List, List | |
Loop % List { | |
WinGet, res, MinMax, % "ahk_id" . List%A_Index% | |
if (res = 1) | |
WinMove, % "ahk_id" . List%A_Index%,, 0, 0, A_ScreenWidth, A_ScreenHeight - !b*H | |
} | |
} | |
;Always on top, except uniqueOnTop group -> Ctrl+Space | |
#IfWinNotActive, ahk_group uniqueOnTop | |
^SPACE:: Winset, Alwaysontop, , A | |
#IfWinNotActive | |
;Always on top, for uniqueOnTop group -> Ctrl+Shift+Space | |
#ifWinActive ahk_group uniqueOnTop | |
^+SPACE:: Winset, Alwaysontop, , A | |
#ifWinActive | |
#ifWinActive ahk_class Vim | |
^/::^_ | |
#ifWinActive | |
;#ifWinActive ahk_exe code.exe | |
; +j:: | |
; Send, ^o | |
; return | |
;#ifWinActive | |
;#ifWinActive ahk_exe code.exe | |
; +k:: | |
; Send, ^i | |
; return | |
;#ifWinActive | |
#IfWinActive ahk_class AcrobatSDIWindow | |
k::Send {Up} | |
l::Send {Right} | |
h::Send {Left} | |
j::Send {Down} | |
Return | |
#ifWinActive | |
#IfWinActive ahk_exe PowerLauncher.exe | |
^j::Send {Down} | |
^k::Send {Up} | |
Return | |
#ifWinActive | |
#IfWinActive ahk_exe msedge.exe | |
^j::Send {Down} | |
^k::Send {Up} | |
Return | |
#ifWinActive | |
#IfWinActive ahk_exe firefox.exe | |
^j::Send {Down} | |
^k::Send {Up} | |
Return | |
#ifWinActive | |
#ifWinActive ahk_exe WindowsTerminal.exe | |
^+l:: Send, ^{Right} | |
^+h:: Send, ^{Left} | |
#ifWinActive | |
;Control volume | |
^Up::Send {Volume_Up 3} | |
^Down::Send {Volume_Down 3} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment