-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMediaArrowKeys.ahk
50 lines (42 loc) · 1.03 KB
/
MediaArrowKeys.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
#Requires AutoHotkey v2.0
/*
When CAPSLOCK is pressed remap:
Right arrow key -> Play next
Left arrow key -> Play previous
Up arrow key -> Volume up
Down arrow key -> Volume down
CTRL + Space -> Play/Pause
*/
send_if_toggled(send_button, pressed_button) {
if GetKeyState("Capslock", "T") {
Send send_button
} else {
Send pressed_button
}
}
Right:: {
send_if_toggled("{Media_Next}", "{Right}")
}
Left:: {
send_if_toggled("{Media_Prev}", "{Left}")
}
Up:: {
send_if_toggled("{Volume_Up}", "{Up}")
}
Down:: {
send_if_toggled("{Volume_Down}", "{Down}")
}
^Space:: {
send_if_toggled("{Media_Play_Pause}", "{^Space}")
}
CapsLock:: {
TrayTip
if GetKeyState("CapsLock", "T") != 1 {
TrayTip "Arrow Media Keys Activated", "", "Mute"
SetTimer TrayTip, -2000
} else {
TrayTip "Arrow Media Keys Deactivated", "", "Mute"
SetTimer TrayTip, -2000
}
SetCapsLockState !GetKeyState("CapsLock", "T")
}