[bugfix] auto arrangement not working

This commit is contained in:
Klesh Wong 2021-07-08 21:36:12 +08:00
parent 656fb92446
commit 91b4eda18f
2 changed files with 7 additions and 6 deletions

View File

@ -113,14 +113,14 @@ MoveActiveWinByDirection(direction) {
wy := wy + PADDING
wh := wh - PADDING * 2
WinMove, A,, wx - l, wy - t, ww + l + r, wh + t + b
LogDebug(Format("move {1} to {2}", activeWinId, direction))
LogDebug("move {1} to {2}", activeWinId, direction)
SaveActiveWindowDirection(direction)
}
SaveArrangement() {
LogDebug("SaveArrangement start")
global ARRANGEMENT
global ARRANGEMENT_PATH
LogDebug("SaveArrangement to {1} start", ARRANGEMENT_PATH)
file := FileOpen(ARRANGEMENT_PATH, "w")
file.Write(JSON.Dump(ARRANGEMENT,, 2))
file.Close()
@ -130,7 +130,7 @@ SaveArrangement() {
LoadArrangement() {
global ARRANGEMENT
global ARRANGEMENT_PATH
LogDebug("LoadArrangement start " .ARRANGEMENT_PATH)
LogDebug("LoadArrangement start {1}", ARRANGEMENT_PATH)
try {
FileRead, temp, %ARRANGEMENT_PATH%
ARRANGEMENT := JSON.Load(temp)
@ -232,11 +232,12 @@ ActiveWinInfo() {
}
AdjustNewWindow() {
global ARRANGEMENT
seen := IsActiveWindowSeen()
arrangable := IsActiveWindowArrangable()
wininfo := ActiveWinInfo()
if not seen {
LogDebug(Format("win: {1}, seen: {2}, arrangable: {3}", wininfo, seen, arrangable))
LogDebug("win: {1}, seen: {2}, arrangable: {3}", wininfo, seen, arrangable)
}
if not seen and arrangable {
windowPath := GetActiveWindowPath()

View File

@ -14,14 +14,14 @@ ToggleDebugging() {
DEBUGGING := not DEBUGGING
}
LogDebug(msg) {
LogDebug(params*) {
global DEBUGGING
if (not DEBUGGING) {
return
}
FormatTIme, now, , MM-dd HH:mm:ss
log := FileOpen("d:\win.ahk.log", "a")
log.WriteLine(Format("[{1}] {2}", now, msg))
log.WriteLine(Format("[{1}] {2}", now, Format(params*)))
log.Close()
}