-
Notifications
You must be signed in to change notification settings - Fork 0
/
HotCorners.ahk
78 lines (72 loc) · 2.11 KB
/
HotCorners.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#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")
{
return
; 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
}
}
; Press Windows
if IsCorner("BottomRight")
{
Send, {LWin down}{d down}
Send, {LWin up}{d up}
Loop
{
if ! IsCorner("BottomRight")
break ; exits loop when mouse is no longer in the corner
}
}