Skip to content

Commit 35229fc

Browse files
FIX: did not position correctly on second monitor
1 parent d1124b6 commit 35229fc

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

iSwitch.ahk

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ return
245245
*/
246246

247247
HotkeyAction:
248+
248249
search =
249250
numallwin = 0
250251
GuiControl,, Edit1
@@ -908,15 +909,18 @@ CalculateWindowDimensions(guiSpacingHorizontal, guiSpacingVertical) {
908909

909910
CurrentMonitorIndex := GetCurrentMonitorIndex()
910911
SysGet, MonitorWorkArea, MonitorWorkArea, %CurrentMonitorIndex%
911-
912-
spacingHorizontalPx := MonitorWorkAreaRight * (guiSpacingHorizontal / 100)
913-
width := MonitorWorkAreaRight - (spacingHorizontalPx * 2)
914-
915-
spacingVerticalPx := MonitorWorkAreaBottom * (guiSpacingVertical / 100)
916-
height := MonitorWorkAreaBottom - (spacingVerticalPx * 2)
917-
918-
x := spacingHorizontalPx
919-
y := spacingVerticalPx
912+
913+
monitorWidth := MonitorWorkAreaRight - MonitorWorkAreaLeft
914+
monitorHeight := MonitorWorkAreaBottom - MonitorWorkAreaTop
915+
916+
spacingHorizontalPx := monitorWidth * (guiSpacingHorizontal / 100)
917+
width := monitorWidth - (spacingHorizontalPx * 2)
918+
919+
spacingVerticalPx := monitorHeight * (guiSpacingVertical / 100)
920+
height := monitorHeight - (spacingVerticalPx * 2)
921+
922+
x := MonitorWorkAreaLeft + spacingHorizontalPx
923+
y := MonitorWorkAreaTop + spacingVerticalPx
920924

921925
array := [x, y, width, height]
922926
return array

0 commit comments

Comments
 (0)