-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvirtualDesktopSwitcher.ahk
More file actions
63 lines (51 loc) · 1.39 KB
/
virtualDesktopSwitcher.ahk
File metadata and controls
63 lines (51 loc) · 1.39 KB
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
#Requires AutoHotkey v2.0
#SingleInstance Force ; Skips dialog box and replaces old instance automatically. Similar to `Reload` command
class VDesktop {
static _CurrentDesktop := 1
static _DesktopCount := 2
static Add() {
VDesktop._DesktopCount++
VDesktop._CurrentDesktop := VDesktop._DesktopCount
Send '^#d'
}
static Delete() {
if (VDesktop._DesktopCount > 1) {
VDesktop._DesktopCount--
VDesktop._CurrentDesktop := VDesktop._DesktopCount
Send '^#{F4}'
}
}
static SwitchToPrev() {
if (VDesktop._CurrentDesktop > 1) {
VDesktop._CurrentDesktop--
Send '^#{Left}'
}
}
static SwitchToNext() {
if (VDesktop._CurrentDesktop < VDesktop._DesktopCount) {
VDesktop._CurrentDesktop++
Send '^#{Right}'
}
}
static JumpTo(targetDesktop) {
if (targetDesktop < 1 || targetDesktop > VDesktop._DesktopCount)
return
while (targetDesktop != VDesktop._CurrentDesktop) {
if (targetDesktop > VDesktop._CurrentDesktop)
VDesktop.SwitchToNext()
else
VDesktop.SwitchToPrev()
}
}
}
; === key mapping ===
+#q::
+#XButton1::VDesktop.SwitchToPrev()
+#w::
+#XButton2::VDesktop.SwitchToNext()
+#n::VDesktop.Add()
+#d::VDesktop.Delete()
+#1::VDesktop.JumpTo(1)
+#2::VDesktop.JumpTo(2)
+#3::VDesktop.JumpTo(3)
+#4::VDesktop.JumpTo(4)