-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacro.ahk
218 lines (193 loc) · 4.72 KB
/
macro.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
#Requires AutoHotkey v2.0
; Refactored to use Tab as a custom modifier
Tab:: HandleTab()
; Function to handle Tab key logic
HandleTab() {
static TabState := 0
if (TabState == 1) {
TabState := 0
Send "{Tab}"
return
}
TabState := 1
SetTimer ResetTabState, -200
KeyWait "Tab", "T0.3"
if !GetKeyState("Tab", "P") {
TabState := 0
Send "{Tab}"
}
}
ResetTabState() {
global TabState
TabState := 0
}
; Brightness adjustment
Tab & 9:: {
Run 'nircmd.exe changebrightness -10'
return
}
Tab & 0:: {
Run 'nircmd.exe changebrightness +10'
return
}
; Right Ctrl mods
RCtrl::Right
AppsKey::Up
RAlt::Left
CapsLock::Down
; Desktop switching
Tab & ,::^#Left
Tab & .::^#Right
Tab & /::#+Right
; PrintScreen key
Tab & BackSpace::PrintScreen
; Media controls
Tab & =::Volume_Up
Tab & -::Volume_Down
Tab & \::Media_Play_Pause
Tab & ]::Media_Next
Tab & [::Media_Prev
; macOS delete
#Backspace::Delete
+#Backspace::+Delete
; Window controls
Tab & z:: WinMinimize "A"
Tab & x:: {
WinGetPos &X, &Y, &W, &H, "A"
if (W < SysGet(78)) {
WinMaximize "A"
} else {
WinRestore "A"
}
}
Tab & c::^w
; -----------------mouse-----------------
XButton2 & WheelUp:: {
Send '^#{Left}'
KeyWait "XButton2"
return
}
XButton2 & WheelDown:: {
Send '^#{Right}'
KeyWait "XButton2"
return
}
; Hold mouse forward button for Ctrl
XButton2:: {
if !KeyWait("XButton2", "T0.5") {
SendInput "{Ctrl Down}"
KeyWait "XButton2"
SendInput "{Ctrl Up}"
return
} else {
Send "{XButton2}"
}
return
}
; Hold mouse back button for Shift
XButton1:: {
if !KeyWait("XButton1", "T0.5") {
SendInput "{Shift Down}"
KeyWait "XButton1"
SendInput "{Shift Up}"
return
} else {
if WinActive("WhatsApp Beta") {
Send "{Esc}"
} else if WinActive("ahk_exe Telegram.exe") {
Send "{Esc}"
} else {
Send "{XButton1}"
}
}
return
}
; -----------------laptop-----------------
; Press the laptop calculator button to play/pause media and hold for next track.
Launch_App2:: {
if !KeyWait("Launch_App2", "T0.4") {
Send "{Media_Next}"
KeyWait "Launch_App2"
} else {
Click "{Media_Play_Pause}"
return
}
}
; Use numpad * and - for volume control if NumLock is off
if !GetKeyState("NumLock", "T") {
NumpadSub:: Send "{Volume_Up}"
NumpadMult:: Send "{Volume_Down}"
}
; Text replacements
::|mon::Monday
::|tue::Tuesday
::|wed::Wednesday
::|thu::Thursday
::|fri::Friday
::|sat::Saturday
::|sun::Sunday
::|jan::January
::|feb::February
::|mar::March
::|apr::April
::|may::May
::|jun::June
::|jul::July
::|aug::August
::|sep::September
::|oct::October
::|nov::November
::|dec::December
::|netlify::https://sameerasw.netlify.app/
::|github::https://github.com/sameerasw/
::|link::https://sameerasw.com/
::|pixel::https://sameerasw.com/pixel
::|macos::https://sameerasw.com/macos
::|linkedin::https://www.linkedin.com/in/sameerasw/
::|twitter::https://twitter.com/sameera_s_w
::|telegram::https://t.me/sameera_s_w
::|instagram::https://www.instagram.com/sameera_s_w/
::|@::sameera_s_w
::|gm::Good Morning!
::|gn::Good Night!
::|wa::WhatsApp
::|tg::Telegram
::|omw::On my way!
::|brb::Be right back!
::|ty::Thank you!
::|yw::You're welcome!
::|np::No problem!
::wlcm::welcome
::|wfh::work from home
::|sri::Sri Lanka
::|hbd::Happy Cake Day
::|hack::https://hackbook.simple.ink/
::lorem::Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam euismod, nisl eget ultricies aliquam, nunc nisl ultricies nunc, quis ultricies nisl nisl eget nisl.
:*:spprt::support
#HotIf WinActive("ahk_exe WindowsTerminal.exe")
{
; git commands
:*:gadd::git add .{enter}
:*:gcom::git commit -m ""{left}
:*:gpush::git push{enter}
:*:gpull::git pull{enter}
:*:gstat::git status{enter}
:*:glog::git log{enter}
:*:gdiff::git diff{enter}
:*:gfetch::git fetch{enter}
:*:gclone::git clone{space}
return
}
; tab fixes with modifiers
^Tab::Send "{Ctrl Down}{Tab}{Ctrl Up}"
+Tab::Send "{Shift Down}{Tab}{Shift Up}"
^+Tab::Send "{Ctrl Down}{Shift Down}{Tab}{Shift Up}{Ctrl Up}"
#Tab::Send "{LWin Down}{Tab}{LWin Up}"
#+Tab::Send "{Shift Down}{LWin Down}{Tab}{LWin Up}{Shift Up}"
^#Tab::Send "{Ctrl Down}{LWin Down}{Tab}{LWin Up}{Ctrl Up}"
!Tab::Send "{Alt Down}{Tab}{Alt Up}"
!+Tab::Send "{Alt Down}{Shift Down}{Tab}{Shift Up}{Alt Up}"
!#Tab::Send "{Alt Down}{LWin Down}{Tab}{LWin Up}{Alt Up}"
!^Tab::Send "{Alt Down}{Ctrl Down}{Tab}{Ctrl Up}{Alt Up}"
!^+Tab::Send "{Alt Down}{Ctrl Down}{Shift Down}{Tab}{Shift Up}{Ctrl Up}{Alt Up}"
!^#Tab::Send "{Alt Down}{Ctrl Down}{LWin Down}{Tab}{LWin Up}{Ctrl Up}{Alt Up}"