Continue the manual merge. Bar.ahk is merged (pretty much unchanged)
This commit is contained in:
parent
c30a4c3f30
commit
e9e5a853cc
7 changed files with 2382 additions and 2506 deletions
1168
src/Bar.ahk
1168
src/Bar.ahk
File diff suppressed because it is too large
Load diff
|
@ -267,29 +267,37 @@ Config_restoreConfig(filename) {
|
||||||
Return
|
Return
|
||||||
|
|
||||||
Loop, READ, %filename%
|
Loop, READ, %filename%
|
||||||
If (SubStr(A_LoopReadLine, 1, 7) = "Config_") {
|
If (SubStr(A_LoopReadLine, 1, 7) = "Config_")
|
||||||
|
{
|
||||||
;Log_msg("Processing line: " . A_LoopReadLine)
|
;Log_msg("Processing line: " . A_LoopReadLine)
|
||||||
i := InStr(A_LoopReadLine, "=")
|
i := InStr(A_LoopReadLine, "=")
|
||||||
var := SubStr(A_LoopReadLine, 1, i - 1)
|
var := SubStr(A_LoopReadLine, 1, i - 1)
|
||||||
val := SubStr(A_LoopReadLine, i + 1)
|
val := SubStr(A_LoopReadLine, i + 1)
|
||||||
type := SubStr(var, 1, 13)
|
type := SubStr(var, 1, 13)
|
||||||
If (type = "Config_hotkey") {
|
If (type = "Config_hotkey")
|
||||||
|
{
|
||||||
|
Debug_logMessage("Processing configured hotkey: " . A_LoopReadLine, 0)
|
||||||
i := InStr(val, "::")
|
i := InStr(val, "::")
|
||||||
key := SubStr(val, 1, i - 1)
|
key := SubStr(val, 1, i - 1)
|
||||||
cmd := SubStr(val, i + 2)
|
cmd := SubStr(val, i + 2)
|
||||||
If Not cmd
|
If Not cmd
|
||||||
Hotkey, %key%, Off
|
Hotkey, %key%, Off
|
||||||
Else {
|
Else
|
||||||
|
{
|
||||||
|
Debug_logMessage(" Hotkey: " . key . " -> " . cmd, 0)
|
||||||
Config_hotkeyCount += 1
|
Config_hotkeyCount += 1
|
||||||
Config_hotkey_#%Config_hotkeyCount%_key := key
|
Config_hotkey_#%Config_hotkeyCount%_key := key
|
||||||
Config_hotkey_#%Config_hotkeyCount%_command := cmd
|
Config_hotkey_#%Config_hotkeyCount%_command := cmd
|
||||||
Hotkey, %key%, Config_hotkeyLabel
|
Hotkey, %key%, Config_hotkeyLabel
|
||||||
}
|
}
|
||||||
} Else If (type = "Config_rule") {
|
}
|
||||||
|
Else If (type = "Config_rule")
|
||||||
|
{
|
||||||
i := 0
|
i := 0
|
||||||
If InStr(var, "Config_rule_#")
|
If InStr(var, "Config_rule_#")
|
||||||
i := SubStr(var, 14)
|
i := SubStr(var, 14)
|
||||||
If (i = 0 Or i > Config_ruleCount) {
|
If (i = 0 Or i > Config_ruleCount)
|
||||||
|
{
|
||||||
Config_ruleCount += 1
|
Config_ruleCount += 1
|
||||||
i := Config_ruleCount
|
i := Config_ruleCount
|
||||||
}
|
}
|
||||||
|
@ -382,11 +390,11 @@ Config_saveSession(original, target)
|
||||||
#+i::Manager_getWindowList()
|
#+i::Manager_getWindowList()
|
||||||
|
|
||||||
;; Window debugging
|
;; Window debugging
|
||||||
#^i::Manager_logViewWindowList()
|
#^i::Debug_logViewWindowList()
|
||||||
#+^i::Manager_logManagedWindowList()
|
#+^i::Debug_logManagedWindowList()
|
||||||
#^h::Manager_logHelp()
|
#^h::Debug_logHelp()
|
||||||
#^[::Log_decDebugLevel()
|
#^d::Debug_setLogLevel(-1)
|
||||||
#^]::Log_incDebugLevel()
|
#^+d::Debug_setLogLevel(+1)
|
||||||
|
|
||||||
;; Layout management
|
;; Layout management
|
||||||
#Tab::View_setLayout(-1)
|
#Tab::View_setLayout(-1)
|
||||||
|
|
167
src/Debug.ahk
Normal file
167
src/Debug.ahk
Normal file
|
@ -0,0 +1,167 @@
|
||||||
|
/*
|
||||||
|
bug.n -- tiling window management
|
||||||
|
Copyright (c) 2010-2012 Joshua Fuhs, joten
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
@version 8.3.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
Debug_initLog(filename, level = 0, truncateFile = True)
|
||||||
|
{
|
||||||
|
Global Debug_logFilename, Debug_logLevel
|
||||||
|
|
||||||
|
Debug_logFilename := filename
|
||||||
|
Debug_logLevel := level
|
||||||
|
If truncateFile
|
||||||
|
If FileExist(Debug_logFilename)
|
||||||
|
FileDelete, %Debug_logFilename%
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug_logHelp()
|
||||||
|
{
|
||||||
|
Debug_logMessage("Help Display", 0)
|
||||||
|
Debug_logMessage("Window list columns", 0, False)
|
||||||
|
Debug_logMessage(" ID - Windows ID. Unique, OS-assigned ID", 0, False)
|
||||||
|
Debug_logMessage(" H - Hidden. Whether bug.n thinks this window is hidden.", 0, False)
|
||||||
|
Debug_logMessage(" W - Windows active. This window is active according to Windows.", 0, False)
|
||||||
|
Debug_logMessage(" A - View active. This window is active according to bug.n.", 0, False)
|
||||||
|
Debug_logMessage(" F - Floating. This window should not be positioned and resized by the layout.", 0, False)
|
||||||
|
Debug_logMessage(" D - Decorated. Does the window have a title bar?", 0, False)
|
||||||
|
Debug_logMessage(" R - Responsive. Is responding to messages?", 0, False)
|
||||||
|
Debug_logMessage(" G - Ghost. Is this window a ghost of another hung window?", 0, False)
|
||||||
|
Debug_logMessage(" M - Monitor number.", 0, False)
|
||||||
|
Debug_logMessage(" Tags - Bit-mask of the views in which the window is active.", 0, False)
|
||||||
|
Debug_logMessage(" X - Windows X position.", 0, False)
|
||||||
|
Debug_logMessage(" Y - Windows Y position.", 0, False)
|
||||||
|
Debug_logMessage(" W - Windows width.", 0, False)
|
||||||
|
Debug_logMessage(" H - Windows height.", 0, False)
|
||||||
|
Debug_logMessage(" Style - Windows style.", 0, False)
|
||||||
|
Debug_logMessage(" Proc / Class / Title - Process/Class/Title of the window.", 0, False)
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug_logManagedWindowList()
|
||||||
|
{
|
||||||
|
Local wndIds
|
||||||
|
|
||||||
|
Debug_logMessage("Window dump for manager")
|
||||||
|
Debug_logMessage("ID`t`tH W A F D R G M`tTags`tX`tY`tW`tH`tStyle`t`tProc / Class / Title", 0, False)
|
||||||
|
|
||||||
|
StringTrimRight, wndIds, Manager_managedWndIds, 1
|
||||||
|
Loop, PARSE, wndIds, `;
|
||||||
|
{
|
||||||
|
Debug_logWindowInfo(A_LoopField)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug_logMessage(text, level = 1, includeTimestamp = True)
|
||||||
|
{
|
||||||
|
Global Debug_logFilename, Debug_logLevel
|
||||||
|
|
||||||
|
If (Debug_logLevel >= level)
|
||||||
|
{
|
||||||
|
If includeTimestamp
|
||||||
|
{
|
||||||
|
FormatTime, time, , yyyy-MM-dd HH:mm:ss
|
||||||
|
text := time " " text
|
||||||
|
}
|
||||||
|
Else
|
||||||
|
text := " " text
|
||||||
|
FileAppend, %text%`r`n, %Debug_logFilename%
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug_logViewWindowList()
|
||||||
|
{
|
||||||
|
Local v, wndIds
|
||||||
|
|
||||||
|
v := Monitor_#%Manager_aMonitor%_aView_#1
|
||||||
|
Debug_logMessage("Window dump for active view (" . Manager_aMonitor . ", " . v . ")")
|
||||||
|
Debug_logMessage("ID`t`tH W A F D R G M`tTags`tX`tY`tW`tH`tStyle`t`tProc / Class / Title", 0, False)
|
||||||
|
|
||||||
|
StringTrimRight, wndIds, View_#%Manager_aMonitor%_#%v%_wndIds, 1
|
||||||
|
Loop, PARSE, wndIds, `;
|
||||||
|
{
|
||||||
|
Debug_logWindowInfo(A_LoopField)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug_logWindowInfo(wndId)
|
||||||
|
{
|
||||||
|
Local aWndId, detect_state, text, v
|
||||||
|
Local isBugnActive, isDecorated, isFloating, isGhost, isHidden, isResponsive, isWinFocus
|
||||||
|
Local wndClass, wndH, wndProc, wndStyle, wndTitle, wndW, wndX, wndY
|
||||||
|
|
||||||
|
detect_state := A_DetectHiddenWindows
|
||||||
|
DetectHiddenWindows, On
|
||||||
|
WinGet, aWndId, ID, A
|
||||||
|
If aWndId = %wndId%
|
||||||
|
isWinFocus := "*"
|
||||||
|
Else
|
||||||
|
isWinFocus := " "
|
||||||
|
v := Monitor_#%Manager_aMonitor%_aView_#1
|
||||||
|
If View_#%Manager_aMonitor%_#%v%_aWndId = %wndId%
|
||||||
|
isBugnActive := "*"
|
||||||
|
Else
|
||||||
|
isBugnActive := " "
|
||||||
|
WinGetTitle, wndTitle, ahk_id %wndId%
|
||||||
|
WinGetClass, wndClass, ahk_id %wndId%
|
||||||
|
WinGet, wndProc, ProcessName, ahk_id %wndId%
|
||||||
|
If InStr(Bar_hiddenWndIds, wndId)
|
||||||
|
isHidden := "*"
|
||||||
|
Else
|
||||||
|
isHidden := " "
|
||||||
|
If Manager_#%wndId%_isFloating
|
||||||
|
isFloating := "*"
|
||||||
|
Else
|
||||||
|
isFloating := " "
|
||||||
|
If Manager_#%wndId%_isDecorated
|
||||||
|
isDecorated := "*"
|
||||||
|
Else
|
||||||
|
isDecorated := " "
|
||||||
|
WinGet, wndStyle, Style, ahk_id %wndId%
|
||||||
|
WinGetPos, wndX, wndY, wndW, wndH, ahk_id %wndId%
|
||||||
|
If Manager_isGhost(wndId)
|
||||||
|
isGhost := "*"
|
||||||
|
Else
|
||||||
|
isGhost := " "
|
||||||
|
DetectHiddenWindows, %detect_state%
|
||||||
|
|
||||||
|
;; Intentionally don't detect hidden windows here to see what Manager_hungTest does
|
||||||
|
If Manager_isHung(wndId)
|
||||||
|
isResponsive := " "
|
||||||
|
Else
|
||||||
|
isResponsive := "*"
|
||||||
|
|
||||||
|
text := wndId "`t"
|
||||||
|
text .= isHidden " " isWinFocus " " isBugnActive " " isFloating " " isDecorated " " isResponsive " " isGhost " "
|
||||||
|
text .= Manager_#%wndId%_monitor "`t" Manager_#%wndId%_tags "`t"
|
||||||
|
text .= wndX "`t" wndY "`t" wndW "`t" wndH "`t" wndStyle "`t" wndProc " / " wndClass " / " wndTitle
|
||||||
|
Debug_logMessage(text , 0, False)
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug_setLogLevel(d)
|
||||||
|
{
|
||||||
|
Global Debug_logLevel
|
||||||
|
|
||||||
|
i := Debug_logLevel + d
|
||||||
|
If (i >= 0)
|
||||||
|
{
|
||||||
|
Debug_logLevel := i
|
||||||
|
If (i = 0)
|
||||||
|
Debug_logMessage("Logging disabled.", 0)
|
||||||
|
Else
|
||||||
|
Debug_logMessage("Log level set to " i ".")
|
||||||
|
}
|
||||||
|
}
|
15
src/Main.ahk
15
src/Main.ahk
|
@ -39,11 +39,10 @@ SetWinDelay, 10
|
||||||
|
|
||||||
Main_setup()
|
Main_setup()
|
||||||
|
|
||||||
Log_init(Main_logFile, False)
|
Debug_initLog(Main_appDir "\log.txt", 0, False)
|
||||||
|
|
||||||
Log_msg("====== Initializing ======")
|
Debug_logMessage("====== Initializing ======")
|
||||||
If 0 = 1
|
Config_filePath := Main_appDir "\Config.ini"
|
||||||
Config_filePath = %1%
|
|
||||||
Config_init()
|
Config_init()
|
||||||
|
|
||||||
Menu, Tray, Tip, %NAME% %VERSION%
|
Menu, Tray, Tip, %NAME% %VERSION%
|
||||||
|
@ -57,17 +56,17 @@ SetWinDelay, 10
|
||||||
|
|
||||||
ResourceMonitor_init()
|
ResourceMonitor_init()
|
||||||
Manager_init()
|
Manager_init()
|
||||||
Log_msg("====== Running ======")
|
Debug_logMessage("====== Running ======", 0)
|
||||||
Return ;; end of the auto-execute section
|
Return ;; end of the auto-execute section
|
||||||
|
|
||||||
;; Function & label definitions
|
;; Function & label definitions
|
||||||
Main_cleanup:
|
Main_cleanup:
|
||||||
Log_msg("====== Cleaning up ======")
|
Debug_logMessage("====== Cleaning up ======", 0)
|
||||||
If Config_autoSaveSession
|
If Config_autoSaveSession
|
||||||
Config_saveSession(Config_filePath, Config_filePath)
|
Config_saveSession(Config_filePath, Config_filePath)
|
||||||
Manager_cleanup()
|
Manager_cleanup()
|
||||||
ResourceMonitor_cleanup()
|
ResourceMonitor_cleanup()
|
||||||
Log_msg("====== Exiting ======")
|
Debug_logMessage("====== Exiting bug.n ======", 0)
|
||||||
ExitApp
|
ExitApp
|
||||||
|
|
||||||
Main_evalCommand(command)
|
Main_evalCommand(command)
|
||||||
|
@ -242,7 +241,7 @@ Main_toggleBar:
|
||||||
Monitor_toggleBar()
|
Monitor_toggleBar()
|
||||||
Return
|
Return
|
||||||
|
|
||||||
#Include Log.ahk
|
#include Debug.ahk
|
||||||
#Include List.ahk
|
#Include List.ahk
|
||||||
#Include Bar.ahk
|
#Include Bar.ahk
|
||||||
#Include Config.ahk
|
#Include Config.ahk
|
||||||
|
|
1744
src/Manager.ahk
1744
src/Manager.ahk
File diff suppressed because it is too large
Load diff
476
src/Monitor.ahk
476
src/Monitor.ahk
|
@ -1,295 +1,295 @@
|
||||||
/**
|
/**
|
||||||
* bug.n - tiling window management
|
* bug.n - tiling window management
|
||||||
* Copyright (c) 2010-2012 joten
|
* Copyright (c) 2010-2012 joten
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* @version 8.3.0
|
* @version 8.3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Monitor_init(m) {
|
Monitor_init(m) {
|
||||||
Global
|
Global
|
||||||
|
|
||||||
Monitor_#%m%_aView_#1 := 1
|
Monitor_#%m%_aView_#1 := 1
|
||||||
Monitor_#%m%_aView_#2 := 1
|
Monitor_#%m%_aView_#2 := 1
|
||||||
Monitor_#%m%_showBar := Config_showBar
|
Monitor_#%m%_showBar := Config_showBar
|
||||||
Loop, % Config_viewCount
|
Loop, % Config_viewCount
|
||||||
View_init(m, A_Index)
|
View_init(m, A_Index)
|
||||||
Config_restoreLayout(Main_autoLayout, m)
|
Config_restoreLayout(Main_autoLayout, m)
|
||||||
Monitor_getWorkArea(m)
|
Monitor_getWorkArea(m)
|
||||||
Bar_init(m)
|
Bar_init(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor_activateView(v) {
|
Monitor_activateView(v) {
|
||||||
Local aView, aWndClass, aWndId, aWndTitle, m, n, wndId, wndIds
|
Local aView, aWndClass, aWndId, aWndTitle, m, n, wndId, wndIds
|
||||||
|
|
||||||
If (v = -1)
|
If (v = -1)
|
||||||
v := Monitor_#%Manager_aMonitor%_aView_#2
|
v := Monitor_#%Manager_aMonitor%_aView_#2
|
||||||
Else If (v = ">")
|
Else If (v = ">")
|
||||||
v := Manager_loop(Monitor_#%Manager_aMonitor%_aView_#1, +1, 1, Config_viewCount)
|
v := Manager_loop(Monitor_#%Manager_aMonitor%_aView_#1, +1, 1, Config_viewCount)
|
||||||
Else If (v = "<")
|
Else If (v = "<")
|
||||||
v := Manager_loop(Monitor_#%Manager_aMonitor%_aView_#1, -1, 1, Config_viewCount)
|
v := Manager_loop(Monitor_#%Manager_aMonitor%_aView_#1, -1, 1, Config_viewCount)
|
||||||
|
|
||||||
Log_dbg_msg(1, "Monitor_activateView(" . v . ") Manager_aMonitor: " . Manager_aMonitor . "; wndIds: " . View_#%m%_#%aView%_wndIds)
|
Debug_logMessage("Monitor_activateView(" . v . ") Manager_aMonitor: " . Manager_aMonitor . "; wndIds: " . View_#%m%_#%aView%_wndIds, 1)
|
||||||
|
|
||||||
If (v <= 0) Or (v > Config_viewCount) Or Manager_hideShow
|
If (v <= 0) Or (v > Config_viewCount) Or Manager_hideShow
|
||||||
Return
|
Return
|
||||||
; Re-arrange the windows on the view.
|
; Re-arrange the windows on the view.
|
||||||
If (v = Monitor_#%Manager_aMonitor%_aView_#1) {
|
If (v = Monitor_#%Manager_aMonitor%_aView_#1) {
|
||||||
View_arrange(Manager_aMonitor, v)
|
View_arrange(Manager_aMonitor, v)
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
aView := Monitor_#%Manager_aMonitor%_aView_#1
|
aView := Monitor_#%Manager_aMonitor%_aView_#1
|
||||||
WinGet, aWndId, ID, A
|
WinGet, aWndId, ID, A
|
||||||
If WinExist("ahk_id" aWndId) And InStr(View_#%Manager_aMonitor%_#%aView%_wndIds, aWndId ";") {
|
If WinExist("ahk_id" aWndId) And InStr(View_#%Manager_aMonitor%_#%aView%_wndIds, aWndId ";") {
|
||||||
WinGetClass, aWndClass, ahk_id %aWndId%
|
WinGetClass, aWndClass, ahk_id %aWndId%
|
||||||
WinGetTitle, aWndTitle, ahk_id %aWndId%
|
WinGetTitle, aWndTitle, ahk_id %aWndId%
|
||||||
If Not (aWndClass = "Progman") And Not (aWndClass = "AutoHotkeyGui" And SubStr(aWndTitle, 1, 10) = "bug.n_BAR_") And Not (aWndClass = "DesktopBackgroundClass")
|
If Not (aWndClass = "Progman") And Not (aWndClass = "AutoHotkeyGui" And SubStr(aWndTitle, 1, 10) = "bug.n_BAR_") And Not (aWndClass = "DesktopBackgroundClass")
|
||||||
View_#%Manager_aMonitor%_#%aView%_aWndId := aWndId
|
View_#%Manager_aMonitor%_#%aView%_aWndId := aWndId
|
||||||
}
|
}
|
||||||
|
|
||||||
n := 1
|
n := 1
|
||||||
If (Config_syncMonitorViews > 0)
|
If (Config_syncMonitorViews > 0)
|
||||||
n := Manager_monitorCount
|
n := Manager_monitorCount
|
||||||
Loop, % n {
|
Loop, % n {
|
||||||
If (n = 1)
|
If (n = 1)
|
||||||
m := Manager_aMonitor
|
m := Manager_aMonitor
|
||||||
Else
|
Else
|
||||||
m := A_Index
|
m := A_Index
|
||||||
|
|
||||||
Monitor_#%m%_aView_#2 := aView
|
Monitor_#%m%_aView_#2 := aView
|
||||||
Monitor_#%m%_aView_#1 := v
|
Monitor_#%m%_aView_#1 := v
|
||||||
|
|
||||||
Manager_hideShow := True
|
Manager_hideShow := True
|
||||||
; Most of the operations here are dispersed to multiple _different_ windows.
|
; Most of the operations here are dispersed to multiple _different_ windows.
|
||||||
; Delays in this part of the code are extremely noticeable and the users
|
; Delays in this part of the code are extremely noticeable and the users
|
||||||
; do a lot of view switching.
|
; do a lot of view switching.
|
||||||
SetWinDelay, 0
|
SetWinDelay, 0
|
||||||
StringTrimRight, wndIds, View_#%m%_#%aView%_wndIds, 1
|
StringTrimRight, wndIds, View_#%m%_#%aView%_wndIds, 1
|
||||||
Loop, PARSE, wndIds, `;
|
Loop, PARSE, wndIds, `;
|
||||||
If Not (Manager_#%A_LoopField%_tags & (1 << v - 1))
|
If Not (Manager_#%A_LoopField%_tags & (1 << v - 1))
|
||||||
Manager_winHide(A_LoopField)
|
Manager_winHide(A_LoopField)
|
||||||
SetWinDelay, 10
|
SetWinDelay, 10
|
||||||
DetectHiddenWindows, On
|
DetectHiddenWindows, On
|
||||||
View_arrange(m, v)
|
View_arrange(m, v)
|
||||||
DetectHiddenWindows, Off
|
DetectHiddenWindows, Off
|
||||||
StringTrimRight, wndIds, View_#%m%_#%v%_wndIds, 1
|
StringTrimRight, wndIds, View_#%m%_#%v%_wndIds, 1
|
||||||
SetWinDelay, 0
|
SetWinDelay, 0
|
||||||
Loop, PARSE, wndIds, `;
|
Loop, PARSE, wndIds, `;
|
||||||
Manager_winShow(A_LoopField)
|
Manager_winShow(A_LoopField)
|
||||||
SetWinDelay, 10
|
SetWinDelay, 10
|
||||||
Manager_hideShow := False
|
Manager_hideShow := False
|
||||||
|
|
||||||
Bar_updateView(m, aView)
|
Bar_updateView(m, aView)
|
||||||
Bar_updateView(m, v)
|
Bar_updateView(m, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
wndId := View_#%Manager_aMonitor%_#%v%_aWndId
|
wndId := View_#%Manager_aMonitor%_#%v%_aWndId
|
||||||
If Not (wndId And WinExist("ahk_id" wndId)) {
|
If Not (wndId And WinExist("ahk_id" wndId)) {
|
||||||
If View_#%Manager_aMonitor%_#%v%_wndIds {
|
If View_#%Manager_aMonitor%_#%v%_wndIds {
|
||||||
wndId := SubStr(View_#%Manager_aMonitor%_#%v%_wndIds, 1, InStr(View_#%Manager_aMonitor%_#%v%_wndIds, ";")-1)
|
wndId := SubStr(View_#%Manager_aMonitor%_#%v%_wndIds, 1, InStr(View_#%Manager_aMonitor%_#%v%_wndIds, ";")-1)
|
||||||
View_#%Manager_aMonitor%_#%v%_aWndId := wndId
|
View_#%Manager_aMonitor%_#%v%_aWndId := wndId
|
||||||
} Else
|
} Else
|
||||||
wndId := 0
|
wndId := 0
|
||||||
}
|
}
|
||||||
Manager_winActivate(wndId)
|
Manager_winActivate(wndId)
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor_get(x, y) {
|
Monitor_get(x, y) {
|
||||||
Local m
|
Local m
|
||||||
|
|
||||||
m := 0
|
m := 0
|
||||||
Loop, % Manager_monitorCount ; Check if the window is on this monitor.
|
Loop, % Manager_monitorCount ; Check if the window is on this monitor.
|
||||||
If (x >= Monitor_#%A_Index%_x && x <= Monitor_#%A_Index%_x+Monitor_#%A_Index%_width && y >= Monitor_#%A_Index%_y && y <= Monitor_#%A_Index%_y+Monitor_#%A_Index%_height) {
|
If (x >= Monitor_#%A_Index%_x && x <= Monitor_#%A_Index%_x+Monitor_#%A_Index%_width && y >= Monitor_#%A_Index%_y && y <= Monitor_#%A_Index%_y+Monitor_#%A_Index%_height) {
|
||||||
m := A_Index
|
m := A_Index
|
||||||
Break
|
Break
|
||||||
}
|
}
|
||||||
|
|
||||||
Return, m
|
Return, m
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor_getWorkArea(m) {
|
Monitor_getWorkArea(m) {
|
||||||
Local bTop, x, y
|
Local bTop, x, y
|
||||||
Local monitor, monitorBottom, monitorLeft, monitorRight, monitorTop
|
Local monitor, monitorBottom, monitorLeft, monitorRight, monitorTop
|
||||||
Local wndClasses, wndHeight, wndId, wndWidth, wndX, wndY
|
Local wndClasses, wndHeight, wndId, wndWidth, wndX, wndY
|
||||||
|
|
||||||
SysGet, monitor, Monitor, %m%
|
SysGet, monitor, Monitor, %m%
|
||||||
|
|
||||||
wndClasses := "Shell_TrayWnd"
|
wndClasses := "Shell_TrayWnd"
|
||||||
If Config_bbCompatibility
|
If Config_bbCompatibility
|
||||||
wndClasses .= ";bbLeanBar;bbSlit;BBToolbar;SystemBarEx"
|
wndClasses .= ";bbLeanBar;bbSlit;BBToolbar;SystemBarEx"
|
||||||
Loop, PARSE, wndClasses, `;
|
Loop, PARSE, wndClasses, `;
|
||||||
{
|
{
|
||||||
wndId := WinExist("ahk_class " A_LoopField)
|
wndId := WinExist("ahk_class " A_LoopField)
|
||||||
If wndId {
|
If wndId {
|
||||||
WinGetPos, wndX, wndY, wndWidth, wndHeight, ahk_id %wndId%
|
WinGetPos, wndX, wndY, wndWidth, wndHeight, ahk_id %wndId%
|
||||||
x := wndX + wndWidth / 2
|
x := wndX + wndWidth / 2
|
||||||
y := wndY + wndHeight / 2
|
y := wndY + wndHeight / 2
|
||||||
If (x >= monitorLeft && x <= monitorRight && y >= monitorTop && y <= monitorBottom) {
|
If (x >= monitorLeft && x <= monitorRight && y >= monitorTop && y <= monitorBottom) {
|
||||||
If (A_LoopField = "Shell_TrayWnd")
|
If (A_LoopField = "Shell_TrayWnd")
|
||||||
Manager_taskBarMonitor := m
|
Manager_taskBarMonitor := m
|
||||||
|
|
||||||
If (wndHeight < wndWidth) { ; Horizontal
|
If (wndHeight < wndWidth) { ; Horizontal
|
||||||
If (wndY <= monitorTop) { ; Top
|
If (wndY <= monitorTop) { ; Top
|
||||||
wndHeight += wndY - monitorTop
|
wndHeight += wndY - monitorTop
|
||||||
monitorTop += wndHeight
|
monitorTop += wndHeight
|
||||||
} Else { ; Bottom
|
} Else { ; Bottom
|
||||||
wndHeight := monitorBottom - wndY
|
wndHeight := monitorBottom - wndY
|
||||||
monitorBottom -= wndHeight
|
monitorBottom -= wndHeight
|
||||||
}
|
}
|
||||||
} Else { ; Vertical
|
} Else { ; Vertical
|
||||||
If (wndX <= monitorLeft) { ; Left
|
If (wndX <= monitorLeft) { ; Left
|
||||||
wndWidth += wndX
|
wndWidth += wndX
|
||||||
monitorLeft += wndWidth
|
monitorLeft += wndWidth
|
||||||
} Else { ; Right
|
} Else { ; Right
|
||||||
wndWidth := monitorRight - wndX
|
wndWidth := monitorRight - wndX
|
||||||
monitorRight -= wndWidth
|
monitorRight -= wndWidth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
If Monitor_#%m%_showBar {
|
If Monitor_#%m%_showBar {
|
||||||
If (Config_verticalBarPos = "top" Or (Config_verticalBarPos = "tray" And Not m = Manager_taskBarMonitor)) {
|
If (Config_verticalBarPos = "top" Or (Config_verticalBarPos = "tray" And Not m = Manager_taskBarMonitor)) {
|
||||||
bTop := monitorTop
|
bTop := monitorTop
|
||||||
monitorTop += Bar_height
|
monitorTop += Bar_height
|
||||||
} Else If (Config_verticalBarPos = "bottom") {
|
} Else If (Config_verticalBarPos = "bottom") {
|
||||||
bTop := monitorBottom - Bar_height
|
bTop := monitorBottom - Bar_height
|
||||||
monitorBottom -= Bar_height
|
monitorBottom -= Bar_height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor_#%m%_height := monitorBottom - monitorTop
|
Monitor_#%m%_height := monitorBottom - monitorTop
|
||||||
Monitor_#%m%_width := monitorRight - monitorLeft
|
Monitor_#%m%_width := monitorRight - monitorLeft
|
||||||
Monitor_#%m%_x := monitorLeft
|
Monitor_#%m%_x := monitorLeft
|
||||||
Monitor_#%m%_y := monitorTop
|
Monitor_#%m%_y := monitorTop
|
||||||
Monitor_#%m%_barY := bTop
|
Monitor_#%m%_barY := bTop
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor_moveWindow(m, wndId) {
|
Monitor_moveWindow(m, wndId) {
|
||||||
Global
|
Global
|
||||||
|
|
||||||
Manager_#%wndId%_monitor := m
|
Manager_#%wndId%_monitor := m
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor_setWindowTag(t) {
|
Monitor_setWindowTag(t) {
|
||||||
Local aView, aWndId, wndId
|
Local aView, aWndId, wndId
|
||||||
|
|
||||||
If (t = ">")
|
If (t = ">")
|
||||||
t := Manager_loop(Monitor_#%Manager_aMonitor%_aView_#1, +1, 1, Config_viewCount)
|
t := Manager_loop(Monitor_#%Manager_aMonitor%_aView_#1, +1, 1, Config_viewCount)
|
||||||
Else If (t = "<")
|
Else If (t = "<")
|
||||||
t := Manager_loop(Monitor_#%Manager_aMonitor%_aView_#1, -1, 1, Config_viewCount)
|
t := Manager_loop(Monitor_#%Manager_aMonitor%_aView_#1, -1, 1, Config_viewCount)
|
||||||
|
|
||||||
WinGet, aWndId, ID, A
|
WinGet, aWndId, ID, A
|
||||||
If (InStr(Manager_managedWndIds, aWndId ";") And t >= 0 And t <= Config_viewCount) {
|
If (InStr(Manager_managedWndIds, aWndId ";") And t >= 0 And t <= Config_viewCount) {
|
||||||
If (t = 0) {
|
If (t = 0) {
|
||||||
Loop, % Config_viewCount
|
Loop, % Config_viewCount
|
||||||
If Not (Manager_#%aWndId%_tags & (1 << A_Index - 1)) {
|
If Not (Manager_#%aWndId%_tags & (1 << A_Index - 1)) {
|
||||||
View_#%Manager_aMonitor%_#%A_Index%_wndIds := aWndId ";" View_#%Manager_aMonitor%_#%A_Index%_wndIds
|
View_#%Manager_aMonitor%_#%A_Index%_wndIds := aWndId ";" View_#%Manager_aMonitor%_#%A_Index%_wndIds
|
||||||
View_#%Manager_aMonitor%_#%A_Index%_aWndId := aWndId
|
View_#%Manager_aMonitor%_#%A_Index%_aWndId := aWndId
|
||||||
Bar_updateView(Manager_aMonitor, A_Index)
|
Bar_updateView(Manager_aMonitor, A_Index)
|
||||||
Manager_#%aWndId%_tags += 1 << A_Index - 1
|
Manager_#%aWndId%_tags += 1 << A_Index - 1
|
||||||
}
|
}
|
||||||
} Else {
|
} Else {
|
||||||
Loop, % Config_viewCount
|
Loop, % Config_viewCount
|
||||||
If Not (A_index = t) {
|
If Not (A_index = t) {
|
||||||
StringReplace, View_#%Manager_aMonitor%_#%A_Index%_wndIds, View_#%Manager_aMonitor%_#%A_Index%_wndIds, %aWndId%`;,
|
StringReplace, View_#%Manager_aMonitor%_#%A_Index%_wndIds, View_#%Manager_aMonitor%_#%A_Index%_wndIds, %aWndId%`;,
|
||||||
View_#%Manager_aMonitor%_#%A_Index%_aWndId := 0
|
View_#%Manager_aMonitor%_#%A_Index%_aWndId := 0
|
||||||
Bar_updateView(Manager_aMonitor, A_Index)
|
Bar_updateView(Manager_aMonitor, A_Index)
|
||||||
}
|
}
|
||||||
|
|
||||||
If Not (Manager_#%aWndId%_tags & (1 << t - 1))
|
If Not (Manager_#%aWndId%_tags & (1 << t - 1))
|
||||||
View_#%Manager_aMonitor%_#%t%_wndIds := aWndId ";" View_#%Manager_aMonitor%_#%t%_wndIds
|
View_#%Manager_aMonitor%_#%t%_wndIds := aWndId ";" View_#%Manager_aMonitor%_#%t%_wndIds
|
||||||
View_#%Manager_aMonitor%_#%t%_aWndId := aWndId
|
View_#%Manager_aMonitor%_#%t%_aWndId := aWndId
|
||||||
Manager_#%aWndId%_tags := 1 << t - 1
|
Manager_#%aWndId%_tags := 1 << t - 1
|
||||||
|
|
||||||
aView := Monitor_#%Manager_aMonitor%_aView_#1
|
aView := Monitor_#%Manager_aMonitor%_aView_#1
|
||||||
If Not (t = aView) {
|
If Not (t = aView) {
|
||||||
Manager_hideShow := True
|
Manager_hideShow := True
|
||||||
wndId := SubStr(View_#%Manager_aMonitor%_#%aView%_wndIds, 1, InStr(View_#%Manager_aMonitor%_#%aView%_wndIds, ";")-1)
|
wndId := SubStr(View_#%Manager_aMonitor%_#%aView%_wndIds, 1, InStr(View_#%Manager_aMonitor%_#%aView%_wndIds, ";")-1)
|
||||||
Manager_winActivate(wndId)
|
Manager_winActivate(wndId)
|
||||||
Manager_hideShow := False
|
Manager_hideShow := False
|
||||||
If Config_viewFollowsTagged
|
If Config_viewFollowsTagged
|
||||||
Monitor_activateView(t)
|
Monitor_activateView(t)
|
||||||
Else {
|
Else {
|
||||||
Manager_hideShow := True
|
Manager_hideShow := True
|
||||||
Manager_winHide(aWndId)
|
Manager_winHide(aWndId)
|
||||||
Manager_hideShow := False
|
Manager_hideShow := False
|
||||||
View_arrange(Manager_aMonitor, aView)
|
View_arrange(Manager_aMonitor, aView)
|
||||||
Bar_updateView(Manager_aMonitor, t)
|
Bar_updateView(Manager_aMonitor, t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor_toggleBar() {
|
Monitor_toggleBar() {
|
||||||
Global
|
Global
|
||||||
|
|
||||||
Monitor_#%Manager_aMonitor%_showBar := Not Monitor_#%Manager_aMonitor%_showBar
|
Monitor_#%Manager_aMonitor%_showBar := Not Monitor_#%Manager_aMonitor%_showBar
|
||||||
Bar_toggleVisibility(Manager_aMonitor)
|
Bar_toggleVisibility(Manager_aMonitor)
|
||||||
Monitor_getWorkArea(Manager_aMonitor)
|
Monitor_getWorkArea(Manager_aMonitor)
|
||||||
View_arrange(Manager_aMonitor, Monitor_#%Manager_aMonitor%_aView_#1)
|
View_arrange(Manager_aMonitor, Monitor_#%Manager_aMonitor%_aView_#1)
|
||||||
Manager_winActivate(Bar_aWndId)
|
Manager_winActivate(Bar_aWndId)
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor_toggleTaskBar() {
|
Monitor_toggleTaskBar() {
|
||||||
Local m
|
Local m
|
||||||
|
|
||||||
m := Manager_aMonitor
|
m := Manager_aMonitor
|
||||||
If (m = Manager_taskBarMonitor) {
|
If (m = Manager_taskBarMonitor) {
|
||||||
Manager_showTaskBar := Not Manager_showTaskBar
|
Manager_showTaskBar := Not Manager_showTaskBar
|
||||||
Manager_hideShow := True
|
Manager_hideShow := True
|
||||||
If Not Manager_showTaskBar {
|
If Not Manager_showTaskBar {
|
||||||
WinHide, Start ahk_class Button
|
WinHide, Start ahk_class Button
|
||||||
WinHide, ahk_class Shell_TrayWnd
|
WinHide, ahk_class Shell_TrayWnd
|
||||||
} Else {
|
} Else {
|
||||||
WinShow, Start ahk_class Button
|
WinShow, Start ahk_class Button
|
||||||
WinShow, ahk_class Shell_TrayWnd
|
WinShow, ahk_class Shell_TrayWnd
|
||||||
}
|
}
|
||||||
Manager_hideShow := False
|
Manager_hideShow := False
|
||||||
Monitor_getWorkArea(m)
|
Monitor_getWorkArea(m)
|
||||||
Bar_move(m)
|
Bar_move(m)
|
||||||
View_arrange(m, Monitor_#%m%_aView_#1)
|
View_arrange(m, Monitor_#%m%_aView_#1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor_toggleWindowTag(t) {
|
Monitor_toggleWindowTag(t) {
|
||||||
Local aWndId, wndId
|
Local aWndId, wndId
|
||||||
|
|
||||||
WinGet, aWndId, ID, A
|
WinGet, aWndId, ID, A
|
||||||
If (InStr(Manager_managedWndIds, aWndId ";") And t >= 0 And t <= Config_viewCount) {
|
If (InStr(Manager_managedWndIds, aWndId ";") And t >= 0 And t <= Config_viewCount) {
|
||||||
If (Manager_#%aWndId%_tags & (1 << t - 1)) {
|
If (Manager_#%aWndId%_tags & (1 << t - 1)) {
|
||||||
If Not ((Manager_#%aWndId%_tags - (1 << t - 1)) = 0) {
|
If Not ((Manager_#%aWndId%_tags - (1 << t - 1)) = 0) {
|
||||||
Manager_#%aWndId%_tags -= 1 << t - 1
|
Manager_#%aWndId%_tags -= 1 << t - 1
|
||||||
StringReplace, View_#%Manager_aMonitor%_#%t%_wndIds, View_#%Manager_aMonitor%_#%t%_wndIds, %aWndId%`;,
|
StringReplace, View_#%Manager_aMonitor%_#%t%_wndIds, View_#%Manager_aMonitor%_#%t%_wndIds, %aWndId%`;,
|
||||||
Bar_updateView(Manager_aMonitor, t)
|
Bar_updateView(Manager_aMonitor, t)
|
||||||
If (t = Monitor_#%Manager_aMonitor%_aView_#1) {
|
If (t = Monitor_#%Manager_aMonitor%_aView_#1) {
|
||||||
Manager_hideShow := True
|
Manager_hideShow := True
|
||||||
Manager_winHide(aWndId)
|
Manager_winHide(aWndId)
|
||||||
Manager_hideShow := False
|
Manager_hideShow := False
|
||||||
wndId := SubStr(View_#%Manager_aMonitor%_#%t%_wndIds, 1, InStr(View_#%Manager_aMonitor%_#%t%_wndIds, ";")-1)
|
wndId := SubStr(View_#%Manager_aMonitor%_#%t%_wndIds, 1, InStr(View_#%Manager_aMonitor%_#%t%_wndIds, ";")-1)
|
||||||
Manager_winActivate(wndId)
|
Manager_winActivate(wndId)
|
||||||
View_arrange(Manager_aMonitor, t)
|
View_arrange(Manager_aMonitor, t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} Else {
|
} Else {
|
||||||
View_#%Manager_aMonitor%_#%t%_wndIds := aWndId ";" View_#%Manager_aMonitor%_#%t%_wndIds
|
View_#%Manager_aMonitor%_#%t%_wndIds := aWndId ";" View_#%Manager_aMonitor%_#%t%_wndIds
|
||||||
View_#%Manager_aMonitor%_#%t%_aWndId := aWndId
|
View_#%Manager_aMonitor%_#%t%_aWndId := aWndId
|
||||||
Bar_updateView(Manager_aMonitor, t)
|
Bar_updateView(Manager_aMonitor, t)
|
||||||
Manager_#%aWndId%_tags += 1 << t - 1
|
Manager_#%aWndId%_tags += 1 << t - 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
870
src/View.ahk
870
src/View.ahk
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue