Skip to content

Commit

Permalink
fix(CapsLockX): windowmanager in side monitor
Browse files Browse the repository at this point in the history
windowmanager in side monitor
  • Loading branch information
snomiao committed Nov 3, 2024
1 parent deb3cb2 commit d0bfe2c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 27 deletions.
Binary file removed Core/clipboard-image-OLD.jpg
Binary file not shown.
Binary file removed Core/clipboard-image.jpg
Binary file not shown.
53 changes: 26 additions & 27 deletions Modules/CLX-WindowManager.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -384,12 +384,12 @@ ArrangeWindowsSideBySide(listOfWindow, arrangeFlags = "0", MonitorIndex = "")
AreaH := A_ScreenHeight
} else {
SysGet, MonitorWorkArea, MonitorWorkArea, %MonitorIndex%
; SysGet, Monitor, Monitor, %MonitorIndex%
AreaX := MonitorWorkAreaLeft
AreaY := MonitorWorkAreaTop
AreaW := MonitorWorkAreaRight - MonitorWorkAreaLeft
AreaH := MonitorWorkAreaBottom - MonitorWorkAreaTop
}

if (arrangeFlags & ARRANGE_MOVING) {
; AreaH /= 2
; TrayTip DEBUG Area, %AreaX% %AreaY% %AreaW% %AreaH%
Expand Down Expand Up @@ -435,7 +435,6 @@ ArrangeWindowsSideBySide(listOfWindow, arrangeFlags = "0", MonitorIndex = "")
w := min(x + w, AreaX + AreaW) - x
h := min(y + h, AreaY + AreaH - 1) - y


FastResizeWindow(hWnd, x, y, w, h)
lasthWnd := hWnd
k-=1
Expand Down Expand Up @@ -490,8 +489,8 @@ ArrangeWindowsStacked(listOfWindow, arrangeFlags = "0", MonitorIndex = "")
AreaH := MonitorWorkAreaBottom - MonitorWorkAreaTop
}

dx := Min(48, AreaW / n - 4 * AreaX)
dy := Min(48, AreaH / n - 4 * AreaY)
dx := Min(48, AreaW / n)
dy := Min(48, AreaH / n)

if (arrangeFlags & ARRANGE_MOVING) {
k := 0
Expand All @@ -509,35 +508,35 @@ ArrangeWindowsStacked(listOfWindow, arrangeFlags = "0", MonitorIndex = "")

x := AreaX + (n - k) * dx
y := AreaY + (n - k) * dy

FastResizeWindow(hWnd, x, y, w, h)
lasthWnd := hWnd
; FastResizeWindow(hWnd, x, y, w, h)
k+=1
}
}
if (arrangeFlags & ARRANGE_Z_ORDERING) {
WinActivate ahk_id %lasthWnd%
SWP_NOACTIVATE := 0x0010
SWP_ASYNCWINDOWPOS:= 0x4000
SWP_NOMOVE := 0x0002
SWP_NOSIZE := 0x0001
lasthWnd := -2
loop, Parse, listOfWindow, `n
{
hWnd := RegExReplace(A_LoopField, "^.*?ahk_id (\S+?)$", "$1")
; WinActivate ahk_id %hWnd%
DllCall("SetWindowPos"
, "UInt", hWnd ; handle
, "UInt", lasthWnd ; z-index
, "Int", 0 ; x
, "Int", 0 ; y
, "Int", 0 ; width
, "Int", 0 ; height
, "UInt", SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_ASYNCWINDOWPOS) ; SWP_ASYNCWINDOWPOS
lasthWnd := hWnd
}

}
; if (false && arrangeFlags & ARRANGE_Z_ORDERING) {
; WinActivate ahk_id %lasthWnd%
; SWP_NOACTIVATE := 0x0010
; SWP_ASYNCWINDOWPOS:= 0x4000
; SWP_NOMOVE := 0x0002
; SWP_NOSIZE := 0x0001
; lasthWnd := -2
; loop, Parse, listOfWindow, `n
; {
; hWnd := RegExReplace(A_LoopField, "^.*?ahk_id (\S+?)$", "$1")
; ; WinActivate ahk_id %hWnd%
; DllCall("SetWindowPos"
; , "UInt", hWnd ; handle
; , "UInt", lasthWnd ; z-index
; , "Int", 0 ; x
; , "Int", 0 ; y
; , "Int", 0 ; width
; , "Int", 0 ; height
; , "UInt", SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_ASYNCWINDOWPOS) ; SWP_ASYNCWINDOWPOS
; lasthWnd := hWnd
; }
; }
; loop, Parse, listOfWindow, `n
; {
; hWnd := RegExReplace(A_LoopField, "^.*?ahk_id (\S+?)$", "$1")
Expand Down

0 comments on commit d0bfe2c

Please sign in to comment.