-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMoveToDesktop.ahk
91 lines (74 loc) · 2.15 KB
/
MoveToDesktop.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
;#Modified to work in VH V2 following failures with V1 on Windows11 build 22621
;#SETUP START
#SingleInstance force
ListLines 0
SendMode "Input"
SetWorkingDir A_ScriptDir
KeyHistory 0
#WinActivateForce
ProcessSetPriority "H"
SetWinDelay -1
SetControlDelay -1
;include the library
;#Include VD.ah2
#Include %A_LineFile%\..\VD.ah2
#Include %A_ScriptDir%\Icons\
; VD.init() ;COMMENT OUT `static dummyStatic1 := VD.init()` if you don't want to init at start of script
ActiveDesktopSetIcon(){
n := VD.getCurrentDesktopNum()
w := A_ScriptDir
if (n<10) {
f := w "\icons\" n ".ico"
}
else {
f := w "\icons\10up.ico"
}
If FileExist(f) {
;Menu, Tray, Icon, f
TraySetIcon f
}
;MsgBox n " " w " " f
}
VD.createUntil(3) ;create until we have at least 3 VD
;MsgBox "Starting AHKMoveToDesktop", VD.goToRelativeDesktopNum(+1) ;MsgBox required to make things work!
;VD.goToDesktopNum(1)
ActiveDesktopSetIcon()
return
; wrapping / cycle back to first desktop when at the last
; using WIN+CTRL+Left
^#Left::VD.goToRelativeDesktopNum(-1), ActiveDesktopSetIcon()
; or WIN+CTRL+Right
^#Right::VD.goToRelativeDesktopNum(+1), ActiveDesktopSetIcon()
; move window to left using WIN+ALT+Left
#!Left::{
VD.MoveWindowToRelativeDesktopNum("A", -1)
ActiveDesktopSetIcon()
}
; move window to right using CTRL+WIN+ALT+Right
#!Right::{
VD.MoveWindowToRelativeDesktopNum("A", 1)
ActiveDesktopSetIcon()
}
; move window to left and follow it using CTRL+WIN+ALT+Left
^#!Left::{
VD.goToDesktopNum(VD.MoveWindowToRelativeDesktopNum("A", -1))
ActiveDesktopSetIcon()
}
; move window to right and follow it using CTRL+WIN+ALT+Right
^#!Right::{
VD.goToDesktopNum(VD.MoveWindowToRelativeDesktopNum("A", 1))
ActiveDesktopSetIcon()
}
;Create a new desktop and switch to it using WIN+CTRL+D
#^d::{
VD.createDesktop(true)
ActiveDesktopSetIcon()
}
; delete the current virtual desktop using WIN+ALT+DEL
#!del::{
VD.removeDesktop(VD.getCurrentDesktopNum())
ActiveDesktopSetIcon()
}
;getters and stuff
;f1::Msgbox VD.getCurrentDesktopNum()
;f2::Msgbox VD.getCount()