5
5
6
6
; -- Ahk2Exe properties
7
7
; @Ahk2Exe-SetName Polygon
8
- ; @Ahk2Exe-SetVersion 0.3 .0
8
+ ; @Ahk2Exe-SetVersion 0.4 .0
9
9
; @Ahk2Exe-SetCompanyName Soham Dasgupta
10
10
; @Ahk2Exe-SetDescription A window manager for Windows 10/11 powered by AutoHotkey
11
11
12
12
; -- Globals
13
- global APP_VERSION := " 0.3 .0"
13
+ global APP_VERSION := " 0.4 .0"
14
14
global APP_VERSION_NAME := " v" . APP_VERSION
15
15
global APP_NAME := " Polygon"
16
16
global APP_REPO_OWNER := " thesobercoder"
@@ -43,6 +43,10 @@ global APP_SHORTCUT_BOTTOMLEFT := IniRead(APP_INI_FILE, APP_INI_SECTION_SHORTCUT
43
43
global APP_SHORTCUT_BOTTOMRIGHT := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " BottomRight" , " ^#k" )
44
44
global APP_SHORTCUT_TOPHALF := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " TopHalf" , " ^#-" )
45
45
global APP_SHORTCUT_BOTTOMHALF := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " BottomHalf" , " ^#=" )
46
+ global APP_SHORTCUT_FIRSTFOURTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " FirstFourth" , " ^#;" )
47
+ global APP_SHORTCUT_SECONDFOURTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " SecondFourth" , " ^#'" )
48
+ global APP_SHORTCUT_THIRDFOURTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " ThirdFourth" , " ^#," )
49
+ global APP_SHORTCUT_LASTFOURTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " LastFourth" , " ^#." )
46
50
; --Tooltip
47
51
A_IconTip := APP_NAME
48
52
; -- Register global error logging
@@ -211,6 +215,11 @@ Hotkey(APP_SHORTCUT_BOTTOMLEFT, BottomLeft)
211
215
Hotkey (APP_SHORTCUT_BOTTOMRIGHT, BottomRight)
212
216
Hotkey (APP_SHORTCUT_TOPHALF, TopHalf)
213
217
Hotkey (APP_SHORTCUT_BOTTOMHALF, BottomHalf)
218
+ Hotkey (APP_SHORTCUT_FIRSTFOURTH, FirstFourth)
219
+ Hotkey (APP_SHORTCUT_SECONDFOURTH, SecondFourth)
220
+ Hotkey (APP_SHORTCUT_THIRDFOURTH, ThirdFourth)
221
+ Hotkey (APP_SHORTCUT_LASTFOURTH, LastFourth)
222
+ ; -- Layout Functions
214
223
Center (* ) {
215
224
if (GetWindowRectEx(& hWnd, & x, & y, & w, & h, & ofl, & ofr, & oft, & ofb, & r, & l, & t, & b))
216
225
{
@@ -238,28 +247,6 @@ CenterHD(*) {
238
247
Toast(" Center HD" , r, l, t, b)
239
248
}
240
249
}
241
- FirstFourth (* ) {
242
- if (GetWindowRectEx(& hWnd, & x, & y, & w, & h, & ofl, & ofr, & oft, & ofb, & r, & l, & t, & b))
243
- {
244
- ; -- Calculate the width of one fourth of the monitor
245
- OneFourthWidth := Ceil ((r - l) / 4 )
246
- ; -- Set the window position to the left one fourth of the monitor
247
- WinMove (l - ofl, t - oft, OneFourthWidth + ofr + ofl, (b - t) + oft + ofb, hWnd)
248
- ; -- Show layout toast
249
- Toast(" First Fourth" , r, l, t, b)
250
- }
251
- }
252
- LastFourth (* ) {
253
- if (GetWindowRectEx(& hWnd, & x, & y, & w, & h, & ofl, & ofr, & oft, & ofb, & r, & l, & t, & b))
254
- {
255
- ; -- Calculate the width of one fourth of the monitor
256
- OneFourthWidth := Ceil ((r - l) / 4 )
257
- ; -- Set the window position to the right one fourth of the monitor
258
- WinMove (r - OneFourthWidth - ofr, t - oft, OneFourthWidth + ofr + ofl, (b - t) + oft + ofb, hWnd)
259
- ; -- Show layout toast
260
- Toast(" Last Fourth" , r, l, t, b)
261
- }
262
- }
263
250
CenterHalf (* ) {
264
251
if (GetWindowRectEx(& hWnd, & x, & y, & w, & h, & ofl, & ofr, & oft, & ofb, & r, & l, & t, & b))
265
252
{
@@ -493,6 +480,50 @@ BottomHalf(*) {
493
480
Toast(" Bottom Half" , r, l, t, b)
494
481
}
495
482
}
483
+ FirstFourth (* ) {
484
+ if (GetWindowRectEx(& hWnd, & x, & y, & w, & h, & ofl, & ofr, & oft, & ofb, & r, & l, & t, & b))
485
+ {
486
+ ; -- Calculate the width of one fourth of the monitor
487
+ OneFourthWidth := Ceil ((r - l) / 4 )
488
+ ; -- Set the window position to the left one fourth of the monitor
489
+ WinMove (l - ofl, t - oft, OneFourthWidth + ofr + ofl, (b - t) + oft + ofb, hWnd)
490
+ ; -- Show layout toast
491
+ Toast(" First Fourth" , r, l, t, b)
492
+ }
493
+ }
494
+ SecondFourth (* ) {
495
+ if (GetWindowRectEx(& hWnd, & x, & y, & w, & h, & ofl, & ofr, & oft, & ofb, & r, & l, & t, & b))
496
+ {
497
+ ; Calculate the width of one-fourth of the monitor
498
+ OneFourthWidth := Ceil ((r - l) / 4 )
499
+ ; Set the window position to the left one-fourth of the monitor
500
+ WinMove (l - ofl + OneFourthWidth, t - oft, OneFourthWidth + ofr + ofl, (b - t) + oft + ofb, hWnd)
501
+ ; Show layout toast
502
+ Toast(" Second Fourth" , r, l, t, b)
503
+ }
504
+ }
505
+ ThirdFourth (* ) {
506
+ if (GetWindowRectEx(& hWnd, & x, & y, & w, & h, & ofl, & ofr, & oft, & ofb, & r, & l, & t, & b))
507
+ {
508
+ ; Calculate the width of one-fourth of the monitor
509
+ OneFourthWidth := Ceil ((r - l) / 4 )
510
+ ; Set the window position to the right one-fourth of the monitor
511
+ WinMove (l - ofl + 2 * OneFourthWidth, t - oft, OneFourthWidth + ofr + ofl, (b - t) + oft + ofb, hWnd)
512
+ ; Show layout toast
513
+ Toast(" Third Fourth" , r, l, t, b)
514
+ }
515
+ }
516
+ LastFourth (* ) {
517
+ if (GetWindowRectEx(& hWnd, & x, & y, & w, & h, & ofl, & ofr, & oft, & ofb, & r, & l, & t, & b))
518
+ {
519
+ ; -- Calculate the width of one fourth of the monitor
520
+ OneFourthWidth := Ceil ((r - l) / 4 )
521
+ ; -- Set the window position to the right one fourth of the monitor
522
+ WinMove (r - OneFourthWidth - ofr, t - oft, OneFourthWidth + ofr + ofl, (b - t) + oft + ofb, hWnd)
523
+ ; -- Show layout toast
524
+ Toast(" Last Fourth" , r, l, t, b)
525
+ }
526
+ }
496
527
GetWindowRectEx (&hWindow := 0, &winX := 0, &winY := 0, &winW := 0, &winH := 0, &winOffsetLeft := 0, &winOffsetRight := 0, &winOffsetTop := 0, &winOffsetBottom := 0, &monRight := 0, &monLeft := 0, &monTop := 0, &monBottom := 0 ) {
497
528
; -- Get the handle of the active window
498
529
hWindow := WinExist (" A" )
@@ -566,4 +597,4 @@ WinGetPosEx(hWindow, &winX := 0, &winY := 0, &winW := 0, &winH := 0, &winOffsetL
566
597
NumPut (" Int" , winOffsetRight := GWR_Right - Right , RECTPlus, 24 )
567
598
NumPut (" Int" , winOffsetBottom := GWR_Bottom - Bottom , RECTPlus, 28 )
568
599
Return & RECTPlus
569
- }
600
+ }
0 commit comments