-
Notifications
You must be signed in to change notification settings - Fork 7
/
app_handling.ahk
255 lines (208 loc) · 6.27 KB
/
app_handling.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
#Include WinTitles.ahk
#include lib/clipboard.ahk
#HotIf WinActive("ahk_class SDL_app")
j::Space
k::PgUp
#HotIf
;-------------------------------------------------
; CapsLock sublime text
CapsLock & s:: {
if !WinExist(WinTitles.SublimeText) {
Run("D:\all\all\Sublime Text\sublime_text.exe")
WinWaitActive(WinTitles.SublimeText, , 10)
}
Sleep 499
WinActivate(WinTitles.SublimeText)
}
;-------------------------------------------------
; CapsLock Telegram
;
; it seems that i cannot open telegram window when it is in task bar, so
; i just chose to reopen it every time. telegram is single instance, so all
; looks good so far :^)
;
; Send is used so that i select the first chat :^)
;
CapsLock & t:: {
if !WinExist(WinTitles.Telegram) {
Run("D:\all\all\Telegram\Telegram.exe")
WinWait(WinTitles.Telegram, , 10)
Sleep 499
WinActivate(WinTitles.Telegram)
; select the most important chat
Sleep 499
Send("{PgDn}")
Sleep 90
Send("{PgUp}")
Sleep 90
Send("{PgUp}")
Sleep 90
Send("{PgUp}")
Sleep 90
Send("{Enter}")
Sleep 499
; ; move the window to its proper position
; NOTE: THIS DOES NOT WORK. SOMETIMES TELEGRAM JUST WONT FUCKING RESIZE.
; RUUUUUUDE!
getTaskbarDimensions(&tw, &th)
w := A_ScreenWidth/2.5
h := A_ScreenHeight - th
x := A_ScreenWidth - w
y := 0
WinMove(x, y, w, h, WinTitles.Telegram)
}
else {
WinActivate(WinTitles.Telegram)
}
}
;-------------------------------------------------
; get taskbar dimensions, assuming bottom position
getTaskbarDimensions(&tw, &th) {
WinGetPos(,, &tw, &th, "ahk_class Shell_TrayWnd")
}
;-------------------------------------------------
; Sublime Text: CapsLock & w to toggle word wrap
#HotIf WinActive(WinTitles.SublimeText)
CapsLock & w:: {
Send "^+P"
Sleep 500
Send "wwp"
Sleep 1500
Send "{Enter}"
}
#HotIf
;-------------------------------------------------
; Intellij Idea: CapsLock & w to toggle word wrap
#HotIf WinActive(WinTitles.IntellijIdea)
CapsLock & w:: {
Send "^+A"
Sleep 500
Send "active editor soft wrap"
Sleep 500
Send "{Enter}"
Sleep 500
Send "{Esc}"
}
#HotIf
;
; TODO
;;-------------------------------------------------
;; hide the TeamViewer message for sponsored session
;; and also close the TeamViewer window afterwards
;hideTeamviewerSponsoredSession() {
; if WinExist(WinTitles.TeamViewerSponsoredSession) {
; SetControlDelay 0
; ControlClick, OK
;
; ; Looping a few times here, because TeamViewer sometimes shows multiple windows after dismissing the first
; loop, 5
; {
; ; It seems that simply Winclose, WinTitles.TeamViewer doesnt work.
; ; I have to actually search for the window and then WinClose the automatically filled variable.
; ; Weird...
; if WinExist(WinTitles.TeamViewer)
; {
; WinClose
; }
; Sleep, 300
; }
;
; }
;}
;-------------------------------------------------
; use just F4 to close some windows
#HotIf false
|| WinActive(WinTitles.Telegram)
; || WinActive(ahk_chrome)
; || WinActive(ahk_firefox)
|| WinActive(WinTitles.Vlc)
|| WinActive(WinTitles.ModernPhotos*)
|| WinActive(WinTitles.ModernMediaPlayer*)
|| WinActive(WinTitles.ModernSkype*)
|| WinActive(WinTitles.ModernDolbyAccess*)
|| WinActive(WinTitles.TeamViewer)
|| WinActive(WinTitles.CorsairCUE)
|| WinActive(WinTitles.Skype)
|| WinActive(WinTitles.BattleNet)
|| WinActive(WinTitles.ACDSee)
|| WinActive(WinTitles.ArmouryCrate)
F4::Send "!{F4}"
#HotIf
;-------------------------------------------------
; disable Home/End in AcdSee
#HotIf WinActive(WinTitles.ACDSee)
Home::Return
End::Return
Ctrl & Home::Home
Ctrl & End::End
#HotIf
;-----------------------
; Open an url in MPV
CapsLock & v:: {
saveClipboard()
Send "^l"
Sleep 100
Send "^a"
Sleep 100
Send "^c"
ClipWait 1
Tippy("Opening mpv with: " A_Clipboard)
Run("D:\all\all\mpv.net\mpvnet.exe " A_Clipboard)
restoreClipboard()
}
;-----------------------
; Microshitsoft Teams is fucking retarded
;
; Replace "Fancy Paste" with Plain text Copy-Pasta
#HotIf WinActive(WinTitles.Feces)
^V:: {
if DllCall("IsClipboardFormatAvailable", "uint", 1)
Send "^+v"
else
Send "^v"
}
#HotIf
; TODO: add a HOTIF for vivaldi instead of doing this blindly for every app
;-------------------------------------------------
; Fix Vivaldi Gestures
;
; The problem with Vivaldi is that on "3 finger swipe" left and right touchpad gestures,
; Vivaldi executes the Browser_Forward and Browser_Back actions both on key up and on key down.
; Therefore the solution is simple: don't send key down events to Vivaldi
; Browser_Back via 3 finger swipe to right
sc16A::Return
sc16A Up::Send "!{Left}" ; This sends Alt+Left
sc06A::Return
sc06A Up::Send "!{Left}" ; This sends Alt+Left
; Browser_Forward via 3 finger swipe to left
sc069::Return
sc069 Up::Send "!{Right}" ; This sends Alt+Right
/*
For the love of god, i can't understand why they don't allow me to use just my keyboard to play the game.
WTF folks?
*/
#HotIf WinActive(WinTitles.BeatSlayer)
J::Send "{LButton}"
K::Send "{RButton}"
#HotIf
#HotIf WinActive(WinTitles.Obsidian)
::.ttt:: {
Send("- [ ] ttt ")
}
!]::Tab
![::Send "{Shift Down}{Tab}{Shift Up}"
#HotIf
/*
Why a KeyDelay for Slack? Because Slack has dogshit slow garbage performance.
If i use normal hotstring replacement for text which has any markup (italic, bold, inline code, etc.), Slack trashes everything ahk types and also losses characters.
Instead, I have to use SendEvent, which respects key delay.
I swear to fucking god, all the JavaScript world is pure fucking garbage.
*/
if(WinActive("ahk_exe slack.exe")) {
SetKeyDelay 150
}
;$q::Send "1q"
;$w::Send "1w"
;$e::Send "1e"
;$r::Send "1r"
;$g::Send "1g"