forked from jpginc/windows10DesktopManager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
desktopManager.ahk
104 lines (89 loc) · 2.4 KB
/
desktopManager.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
class JPGIncDesktopManagerClass
{
__new()
{
this._desktopChanger := new JPGIncDesktopChangerClass()
this._windowMover := new JPGIncWindowMoverClass()
this.hotkeyManager := new JPGIncHotkeyManager()
this._setupDefaultHotkeys()
return this
}
/*
* Public API to setup virtual desktop hotkeys and callbacks
*/
setGoToDesktop(hotkeyKey)
{
this.hotkeyManager.setupNumberedHotkey(this._desktopChanger, this._desktopChanger.goToDesktopCallbackFunctionName, hotkeyKey)
return this
}
setMoveWindowToDesktop(hotkeyKey)
{
this.hotkeyManager.setupNumberedHotkey(this._windowMover, this._windowMover.moveActiveWindowToDesktopFunctionName, hotkeyKey)
return this
}
setGoToNextDesktop(hotkeyKey)
{
this.hotkeyManager.setupHotkey(this._desktopChanger, this._desktopChanger.nextDesktopFunctionName, hotkeyKey)
return this
}
setGoToPreviousDesktop(hotkeyKey)
{
this.hotkeyManager.setupHotkey(this._desktopChanger, this._desktopChanger.PreviousDesktopFunctionName, hotkeyKey)
return this
}
setMoveWindowToNextDesktop(hotkeyKey)
{
this.hotkeyManager.setupHotkey(this._windowMover, this._windowMover.moveToNextFunctionName, hotkeyKey)
return this
}
setMoveWindowToPreviousDesktop(hotkeyKey)
{
this.hotkeyManager.setupHotkey(this._windowMover, this._windowMover.moveToPreviousFunctionName, hotkeyKey)
return this
}
setCloseDesktop(hotkeyKey)
{
this.hotkeyManager.setupHotkey(this, "closeDesktop", hotkeyKey)
return this
}
setNewDesktop(hotkeyKey)
{
this.hotkeyManager.setupHotkey(this, "newDesktop", hotkeyKey)
return this
}
afterGoToDesktop(functionLabelOrClassWithCallMethodName)
{
this._desktopChanger.postGoToDesktopFunctionName := functionLabelOrClassWithCallMethodName
return this
}
afterMoveWindowToDesktop(functionLabelOrClassWithCallMethodName)
{
this._windowMover.postMoveWindowFunctionName := functionLabelOrClassWithCallMethodName
return this
}
followToDesktopAfterMovingWindow(bool)
{
this._windowMover.followToNewDesktop := bool
return this
}
/*
* end public api
*/
newDesktop(hotkeyCombo := "")
{
send("^#d")
return this
}
closeDesktop(hotkeyCombo := "")
{
send("^#{f4}")
return this
}
_setupDefaultHotkeys()
{
Hotkey, IfWinActive, ahk_class MultitaskingViewFrame
this.hotkeyManager.setupNumberedHotkey(this._desktopChanger, this._desktopChanger.goToDesktopCallbackFunctionName, "")
Hotkey, If
return this
}
}