5
5
6
6
; -- Ahk2Exe properties
7
7
; @Ahk2Exe-SetName Polygon
8
- ; @Ahk2Exe-SetVersion 0.6 .0
8
+ ; @Ahk2Exe-SetVersion 0.7 .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.6 .0"
13
+ global APP_VERSION := " 0.7 .0"
14
14
global APP_VERSION_NAME := " v" . APP_VERSION
15
15
global APP_NAME := " Polygon"
16
16
global APP_REPO_OWNER := " thesobercoder"
@@ -21,34 +21,34 @@ global APP_UPDATE_URL := APP_URL . "/releases/latest"
21
21
global APP_INI_FILE := " polygon.ini"
22
22
global APP_INI_SECTION_SHORTCUT := " Shortcut"
23
23
global APP_INI_SECTION_TOAST := " Toast"
24
- global APP_SETTING_ISTOASTENABLED := IniRead (APP_INI_FILE, APP_INI_SECTION_TOAST, " Show" , " 1 " ) == " 1" ? true : false
25
- global APP_SHORTCUT_CENTER := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " Center" , " ^#c " )
26
- global APP_SHORTCUT_CENTERHD := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " CenterHD" , " ^#/ " )
27
- global APP_SHORTCUT_CENTERHALF := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " CenterHalf" , " ^#w " )
28
- global APP_SHORTCUT_CENTERTWOTHIRD := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " CenterTwoThird" , " ^#r " )
29
- global APP_SHORTCUT_FIRSTTWOTHIRD := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " FirstTwoThird" , " ^#a " )
30
- global APP_SHORTCUT_LASTTWOTHIRD := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " LastTwoThird" , " ^#h " )
31
- global APP_SHORTCUT_FIRSTTHIRD := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " FirstThird" , " ^#d " )
32
- global APP_SHORTCUT_CENTERTHIRD := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " CenterThird" , " ^#f " )
33
- global APP_SHORTCUT_LASTTHIRD := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " LastThird" , " ^#g " )
34
- global APP_SHORTCUT_TOPLEFTSIXTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " TopLeftSixth" , " ^#z " )
35
- global APP_SHORTCUT_BOTTOMLEFTSIXTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " BottomLeftSixth" , " ^#x " )
36
- global APP_SHORTCUT_TOPRIGHTSIXTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " TopRightSixth" , " ^#v " )
37
- global APP_SHORTCUT_BOTTOMRIGHTSIXTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " BottomRightSixth" , " ^#b " )
38
- global APP_SHORTCUT_TOPCENTERSIXTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " TopCenterSixth" , " ^#n " )
39
- global APP_SHORTCUT_BOTTOMCENTERSIXTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " BottomCenterSixth" , " ^#m " )
40
- global APP_SHORTCUT_LEFTHALF := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " LeftHalf" , " ^#[ " )
41
- global APP_SHORTCUT_RIGHTHALF := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " RightHalf" , " ^#] " )
42
- global APP_SHORTCUT_TOPLEFT := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " TopLeft" , " ^#u " )
43
- global APP_SHORTCUT_TOPRIGHT := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " TopRight" , " ^#i " )
44
- global APP_SHORTCUT_BOTTOMLEFT := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " BottomLeft" , " ^#j " )
45
- global APP_SHORTCUT_BOTTOMRIGHT := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " BottomRight" , " ^#k " )
46
- global APP_SHORTCUT_TOPHALF := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " TopHalf" , " ^#- " )
47
- global APP_SHORTCUT_BOTTOMHALF := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " BottomHalf" , " ^#= " )
48
- global APP_SHORTCUT_FIRSTFOURTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " FirstFourth" , " ^#; " )
49
- global APP_SHORTCUT_SECONDFOURTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " SecondFourth" , " ^#' " )
50
- global APP_SHORTCUT_THIRDFOURTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " ThirdFourth" , " ^#, " )
51
- global APP_SHORTCUT_LASTFOURTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " LastFourth" , " ^#. " )
24
+ global APP_SETTING_ISTOASTENABLED := IniRead (APP_INI_FILE, APP_INI_SECTION_TOAST, " Show" , " 0 " ) == " 1" ? true : false
25
+ global APP_SHORTCUT_CENTER := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " Center" , "" )
26
+ global APP_SHORTCUT_CENTERHD := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " CenterHD" , "" )
27
+ global APP_SHORTCUT_CENTERHALF := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " CenterHalf" , "" )
28
+ global APP_SHORTCUT_CENTERTWOTHIRD := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " CenterTwoThird" , "" )
29
+ global APP_SHORTCUT_FIRSTTWOTHIRD := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " FirstTwoThird" , "" )
30
+ global APP_SHORTCUT_LASTTWOTHIRD := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " LastTwoThird" , "" )
31
+ global APP_SHORTCUT_FIRSTTHIRD := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " FirstThird" , "" )
32
+ global APP_SHORTCUT_CENTERTHIRD := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " CenterThird" , "" )
33
+ global APP_SHORTCUT_LASTTHIRD := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " LastThird" , "" )
34
+ global APP_SHORTCUT_TOPLEFTSIXTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " TopLeftSixth" , "" )
35
+ global APP_SHORTCUT_BOTTOMLEFTSIXTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " BottomLeftSixth" , "" )
36
+ global APP_SHORTCUT_TOPRIGHTSIXTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " TopRightSixth" , "" )
37
+ global APP_SHORTCUT_BOTTOMRIGHTSIXTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " BottomRightSixth" , "" )
38
+ global APP_SHORTCUT_TOPCENTERSIXTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " TopCenterSixth" , "" )
39
+ global APP_SHORTCUT_BOTTOMCENTERSIXTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " BottomCenterSixth" , "" )
40
+ global APP_SHORTCUT_LEFTHALF := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " LeftHalf" , "" )
41
+ global APP_SHORTCUT_RIGHTHALF := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " RightHalf" , "" )
42
+ global APP_SHORTCUT_TOPLEFT := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " TopLeft" , "" )
43
+ global APP_SHORTCUT_TOPRIGHT := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " TopRight" , "" )
44
+ global APP_SHORTCUT_BOTTOMLEFT := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " BottomLeft" , "" )
45
+ global APP_SHORTCUT_BOTTOMRIGHT := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " BottomRight" , "" )
46
+ global APP_SHORTCUT_TOPHALF := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " TopHalf" , "" )
47
+ global APP_SHORTCUT_BOTTOMHALF := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " BottomHalf" , "" )
48
+ global APP_SHORTCUT_FIRSTFOURTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " FirstFourth" , "" )
49
+ global APP_SHORTCUT_SECONDFOURTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " SecondFourth" , "" )
50
+ global APP_SHORTCUT_THIRDFOURTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " ThirdFourth" , "" )
51
+ global APP_SHORTCUT_LASTFOURTH := IniRead (APP_INI_FILE, APP_INI_SECTION_SHORTCUT, " LastFourth" , "" )
52
52
; --Tooltip
53
53
A_IconTip := APP_NAME
54
54
; -- Register global error logging
@@ -199,34 +199,39 @@ Terminate(*) {
199
199
ShowVersion (* ) {
200
200
MsgBox (" Version " . APP_VERSION, APP_NAME, " Iconi" )
201
201
}
202
- ; -- Map Hotkeys
203
- Hotkey (APP_SHORTCUT_CENTER, Center )
204
- Hotkey (APP_SHORTCUT_CENTERHD, CenterHD)
205
- Hotkey (APP_SHORTCUT_CENTERHALF, CenterHalf)
206
- Hotkey (APP_SHORTCUT_CENTERTWOTHIRD, CenterTwoThird)
207
- Hotkey (APP_SHORTCUT_FIRSTTHIRD, FirstThird)
208
- Hotkey (APP_SHORTCUT_CENTERTHIRD, CenterThird)
209
- Hotkey (APP_SHORTCUT_FIRSTTWOTHIRD, FirstTwoThird)
210
- Hotkey (APP_SHORTCUT_LASTTWOTHIRD, LastTwoThird)
211
- Hotkey (APP_SHORTCUT_LASTTHIRD, LastThird)
212
- Hotkey (APP_SHORTCUT_TOPLEFTSIXTH, TopLeftSixth)
213
- Hotkey (APP_SHORTCUT_BOTTOMLEFTSIXTH, BottomLeftSixth)
214
- Hotkey (APP_SHORTCUT_TOPRIGHTSIXTH, TopRightSixth)
215
- Hotkey (APP_SHORTCUT_BOTTOMRIGHTSIXTH, BottomRightSixth)
216
- Hotkey (APP_SHORTCUT_TOPCENTERSIXTH, TopCenterSixth)
217
- Hotkey (APP_SHORTCUT_BOTTOMCENTERSIXTH, BottomCenterSixth)
218
- Hotkey (APP_SHORTCUT_LEFTHALF, LeftHalf)
219
- Hotkey (APP_SHORTCUT_RIGHTHALF, RightHalf)
220
- Hotkey (APP_SHORTCUT_TOPLEFT, TopLeft)
221
- Hotkey (APP_SHORTCUT_TOPRIGHT, TopRight)
222
- Hotkey (APP_SHORTCUT_BOTTOMLEFT, BottomLeft)
223
- Hotkey (APP_SHORTCUT_BOTTOMRIGHT, BottomRight)
224
- Hotkey (APP_SHORTCUT_TOPHALF, TopHalf)
225
- Hotkey (APP_SHORTCUT_BOTTOMHALF, BottomHalf)
226
- Hotkey (APP_SHORTCUT_FIRSTFOURTH, FirstFourth)
227
- Hotkey (APP_SHORTCUT_SECONDFOURTH, SecondFourth)
228
- Hotkey (APP_SHORTCUT_THIRDFOURTH, ThirdFourth)
229
- Hotkey (APP_SHORTCUT_LASTFOURTH, LastFourth)
202
+ SetConditionalHotkey (shortcut, func ) {
203
+ if (shortcut && shortcut ! = "" ) {
204
+ Hotkey (shortcut, func)
205
+ }
206
+ }
207
+ ; -- Map Hotkeys using SetConditionalHotkey function
208
+ SetConditionalHotkey(APP_SHORTCUT_CENTER, Center )
209
+ SetConditionalHotkey(APP_SHORTCUT_CENTERHD, CenterHD)
210
+ SetConditionalHotkey(APP_SHORTCUT_CENTERHALF, CenterHalf)
211
+ SetConditionalHotkey(APP_SHORTCUT_CENTERTWOTHIRD, CenterTwoThird)
212
+ SetConditionalHotkey(APP_SHORTCUT_FIRSTTHIRD, FirstThird)
213
+ SetConditionalHotkey(APP_SHORTCUT_CENTERTHIRD, CenterThird)
214
+ SetConditionalHotkey(APP_SHORTCUT_FIRSTTWOTHIRD, FirstTwoThird)
215
+ SetConditionalHotkey(APP_SHORTCUT_LASTTWOTHIRD, LastTwoThird)
216
+ SetConditionalHotkey(APP_SHORTCUT_LASTTHIRD, LastThird)
217
+ SetConditionalHotkey(APP_SHORTCUT_TOPLEFTSIXTH, TopLeftSixth)
218
+ SetConditionalHotkey(APP_SHORTCUT_BOTTOMLEFTSIXTH, BottomLeftSixth)
219
+ SetConditionalHotkey(APP_SHORTCUT_TOPRIGHTSIXTH, TopRightSixth)
220
+ SetConditionalHotkey(APP_SHORTCUT_BOTTOMRIGHTSIXTH, BottomRightSixth)
221
+ SetConditionalHotkey(APP_SHORTCUT_TOPCENTERSIXTH, TopCenterSixth)
222
+ SetConditionalHotkey(APP_SHORTCUT_BOTTOMCENTERSIXTH, BottomCenterSixth)
223
+ SetConditionalHotkey(APP_SHORTCUT_LEFTHALF, LeftHalf)
224
+ SetConditionalHotkey(APP_SHORTCUT_RIGHTHALF, RightHalf)
225
+ SetConditionalHotkey(APP_SHORTCUT_TOPLEFT, TopLeft)
226
+ SetConditionalHotkey(APP_SHORTCUT_TOPRIGHT, TopRight)
227
+ SetConditionalHotkey(APP_SHORTCUT_BOTTOMLEFT, BottomLeft)
228
+ SetConditionalHotkey(APP_SHORTCUT_BOTTOMRIGHT, BottomRight)
229
+ SetConditionalHotkey(APP_SHORTCUT_TOPHALF, TopHalf)
230
+ SetConditionalHotkey(APP_SHORTCUT_BOTTOMHALF, BottomHalf)
231
+ SetConditionalHotkey(APP_SHORTCUT_FIRSTFOURTH, FirstFourth)
232
+ SetConditionalHotkey(APP_SHORTCUT_SECONDFOURTH, SecondFourth)
233
+ SetConditionalHotkey(APP_SHORTCUT_THIRDFOURTH, ThirdFourth)
234
+ SetConditionalHotkey(APP_SHORTCUT_LASTFOURTH, LastFourth)
230
235
; -- Layout Functions
231
236
Center (* ) {
232
237
if (GetWindowRectEx(& hWnd, & x, & y, & w, & h, & ofl, & ofr, & oft, & ofb, & r, & l, & t, & b))
@@ -635,4 +640,4 @@ WinGetPosEx(hWindow, &winX := 0, &winY := 0, &winW := 0, &winH := 0, &winOffsetL
635
640
NumPut (" Int" , winOffsetRight := GWR_Right - Right , RECTPlus, 24 )
636
641
NumPut (" Int" , winOffsetBottom := GWR_Bottom - Bottom , RECTPlus, 28 )
637
642
Return & RECTPlus
638
- }
643
+ }
0 commit comments