-
Notifications
You must be signed in to change notification settings - Fork 5
/
hotcorners.ahk
143 lines (138 loc) · 3.33 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
hotcorners(){
CoordMode, Mouse, Screen
static counter:=0, trigger:=False, smallDelay:=2, delay:=10
counterTemp:=0
MouseGetPos, xpos, ypos
buttonsPressed:= GetKeyState("LButton") OR GetKeyState("RButton")
;tooltip, % "X:" xpos "+" A_ScreenWidth-xpos "=" A_ScreenWidth "`nY:" ypos "+" A_ScreenHeight-ypos "=" A_ScreenHeight "`nTrigger=" trigger "`nCounter=" counter
; Edges not containing trigger:=True will fire contineously. Counter can be used to controll the frequency of firing.
; Corners must always contain trigger:=True. Otherwise, edge to corner transitions will fire the corresponding edge.
/* How to use counter:
; Repeat
counterTemp:=counter+1
if (counterTemp>delay){
DO THIS
counterTemp:=0
}
; No repeat
counterTemp:=counter+1
if (counterTemp==delay){ ; After delay, but dont repeat
DO THIS
trigger:=True
}
; NB: Make sure to disable "trigger:=True" at the top
*/
if (xpos<2) {
if (ypos<2){
if (!trigger){
; trigger:=True
if(!buttonsPressed){
; Top Left
counterTemp:=counter+1
if (counterTemp==smallDelay){ ; After delay, but dont repeat
send, #{tab}
trigger:=True
}
;---------------------------------------------------------
}
}
}
else if (ypos+2>=A_ScreenHeight){
if (!trigger){
; trigger:=True
if(!buttonsPressed){
; Bottom Left
counterTemp:=counter+1
if (counterTemp==delay){ ; After delay, but dont repeat
Send, #n
trigger:=True
}
;---------------------------------------------------------
}
}
}
else {
if (!trigger){
; trigger:=True
if(!buttonsPressed){
; Left
; counterTemp:=counter+1
; if (counterTemp>=delay){
; Send, #^{Left}
; counterTemp:=0
; }
;---------------------------------------------------------
}
}
}
}
else if (xpos+2>=A_ScreenWidth) {
if (ypos<2) {
if (!trigger){
trigger:=True
if(!buttonsPressed){
; Top Right
;---------------------------------------------------------
}
}
lastYedge:="Top"
}
else if (ypos+2>=A_ScreenHeight){
if (!trigger){
;trigger:=True
if(!buttonsPressed){
; Bottom Right
; counterTemp:=counter+1
; if (counterTemp==delay){ ; After delay, but dont repeat
; Send, #a
; trigger:=True
; }
;---------------------------------------------------------
}
}
}
else {
lastcorner:="None"
if (!trigger){
; trigger:=True
if(!buttonsPressed){
; Right
; counterTemp:=counter+1
; if (counterTemp>delay){
; Send, #^{Right}
; counterTemp:=0
; }
;---------------------------------------------------------
}
}
}
lastXedge:="Right"
}
else if (ypos<2){
if (!trigger){
trigger:=True
if(!buttonsPressed){
; Top
;-------------------------------------------------------------
}
}
}
else if (ypos+2>=A_ScreenHeight){
if (!trigger){
; trigger:=True
if(!buttonsPressed){
; Bottom
; counterTemp:=counter+1
; if (counterTemp>delay){
; send, #{Tab}
; trigger:=True
; counterTemp:=0
; }
;-------------------------------------------------------------
}
}
}
else trigger:=False
counter:=counterTemp
;ToolTip, %LastCorner%%LastXEdge%%LastYEdge%
}