-
Notifications
You must be signed in to change notification settings - Fork 0
/
w7keys.ahk
90 lines (76 loc) · 2.3 KB
/
w7keys.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
#Up:: ; Win+Up to Maximize
WinGet, winStatus, MinMax, A
If winStatus = 0
{
WinMaximize, A
}
Return
#Down:: ; Win+Down to Restore/Minimize
WinGet, winStatus, MinMax, A
If winStatus = 1
{
WinRestore, A
}
Else If winStatus = 0
{
WinMinimize, A
}
Return
#Left:: ; Win+Left to dock left
SysGet, MonitorWorkArea, MonitorWorkArea
scrnWidth := MonitorWorkAreaRight - MonitorWorkAreaLeft
scrnHeight := MonitorWorkAreaBottom - MonitorWorkAreaTop
winNewWidth := scrnWidth / 2
winNewHeight := scrnHeight
WinGet, winStatus, MinMax, A
If winStatus = 1
{
; Unmaximize first, otherwise the window will think it's still maximized later.
WinRestore, A
}
WinMove, A, , %MonitorWorkAreaLeft%, %MonitorWorkAreaTop%, %winNewWidth%, %winNewHeight%
Return
#Right:: ; Win+Right to dock right
SysGet, MonitorWorkArea, MonitorWorkArea
scrnWidth := MonitorWorkAreaRight - MonitorWorkAreaLeft
scrnHeight := MonitorWorkAreaBottom - MonitorWorkAreaTop
winNewPoint := scrnWidth / 2
winNewWidth := scrnWidth / 2
winNewHeight := scrnHeight
WinGet, winStatus, MinMax, A
If winStatus = 1
{
; Unmaximize first, otherwise the window will think it's still maximized later.
WinRestore, A
}
WinMove, A, , %winNewPoint%, %MonitorWorkAreaTop%, %winNewWidth%, %winNewHeight%
Return
^#Up::
SysGet, MonitorWorkArea, MonitorWorkArea
scrnWidth := MonitorWorkAreaRight - MonitorWorkAreaLeft
scrnHeight := MonitorWorkAreaBottom - MonitorWorkAreaTop
winNewWidth := scrnWidth
winNewHeight := scrnHeight / 2
WinGet, winStatus, MinMax, A
If winStatus = 1
{
; Unmaximize first, otherwise the window will think it's still maximized later.
WinRestore, A
}
WinMove, A, , %MonitorWorkAreaLeft%, %MonitorWorkAreaTop%, %winNewWidth%, %winNewHeight%
Return
^#Down::
SysGet, MonitorWorkArea, MonitorWorkArea
scrnWidth := MonitorWorkAreaRight - MonitorWorkAreaLeft
scrnHeight := MonitorWorkAreaBottom - MonitorWorkAreaTop
winNewPoint := scrnHeight / 2
winNewWidth := scrnWidth
winNewHeight := scrnHeight / 2
WinGet, winStatus, MinMax, A
If winStatus = 1
{
; Unmaximize first, otherwise the window will think it's still maximized later.
WinRestore, A
}
WinMove, A, , %MonitorWorkAreaLeft%, %winNewPoint%, %winNewWidth%, %winNewHeight%
Return