implemented feature 'single window action' (i. e. close or maximize) configured by rule
This commit is contained in:
parent
23b4ef559f
commit
8fc99c95cf
2 changed files with 43 additions and 17 deletions
|
@ -72,17 +72,20 @@ Config_init()
|
|||
Config_syncMonitorViews := 0
|
||||
Config_viewFollowsTagged := False
|
||||
|
||||
Config_rule_#1 := ".*;.*;;1;0;0;0;0;0" ;; default rule
|
||||
Config_rule_#2 := ".*;.*;0x80000000;0;0;0;1;1;1" ;; Pop-up windows (style WS_POPUP=0x80000000) will not be managed, are floating and the titles are hidden.
|
||||
Config_rule_#3 := "SWT_Window0;.*;;1;0;0;0;0;0" ;; Windows created by Java (SWT) e. g. Eclipse have the style WS_POPUP, but should be excluded from the second rule.
|
||||
Config_rule_#4 := "QWidget;.*;;1;0;0;0;0;0" ;; ... also windows created by QT (QWidget)
|
||||
Config_rule_#5 := "Xming;.*;;1;0;0;0;0;0" ;; ... and Xming windows
|
||||
Config_rule_#6 := "MsiDialog(No)?CloseClass;.*;;1;0;0;1;1;0"
|
||||
Config_rule_#7 := "AdobeFlashPlayerInstaller;.*;;1;0;0;1;0;1"
|
||||
Config_rule_#8 := "CalcFrame;.*;;1;0;0;1;1;0"
|
||||
Config_rule_#9 := "MozillaDialogClass;.*;;1;0;0;1;1;0"
|
||||
Config_rule_#10 := "_sp;_sp;;1;0;0;1;0;1"
|
||||
Config_ruleCount := 10 ;; This variable has to be set to the total number of active rules above.
|
||||
;; Config_rule_#<i> := '<class>;<title>;<style>;<is managed>;<m>;<tags>;<is floating>;<is decorated>;<hide title>;<action>'
|
||||
Config_rule_#1 := ".*;.*;;1;0;0;0;0;0;" ;; default rule
|
||||
Config_rule_#2 := ".*;.*;0x80000000;0;0;0;1;1;1;" ;; Pop-up windows (style WS_POPUP=0x80000000) will not be managed, are floating and the titles are hidden.
|
||||
Config_rule_#3 := "SWT_Window0;.*;;1;0;0;0;0;0;" ;; Windows created by Java (SWT) e. g. Eclipse have the style WS_POPUP, but should be excluded from the second rule.
|
||||
Config_rule_#4 := "QWidget;.*;;1;0;0;0;0;0;" ;; ... also windows created by QT (QWidget)
|
||||
Config_rule_#5 := "Xming;.*;;1;0;0;0;0;0;" ;; ... and Xming windows
|
||||
Config_rule_#6 := "MsiDialog(No)?CloseClass;.*;;1;0;0;1;1;0;"
|
||||
Config_rule_#7 := "AdobeFlashPlayerInstaller;.*;;1;0;0;1;0;1;"
|
||||
Config_rule_#8 := "CalcFrame;.*;;1;0;0;1;1;0;"
|
||||
Config_rule_#9 := "MozillaDialogClass;.*;;1;0;0;1;1;0;"
|
||||
Config_rule_#10 := "_sp;_sp;;1;0;0;1;0;1;"
|
||||
Config_rule_#11 := "MozillaWindowClass;.* - Mozilla Firefox;;1;0;0;0;1;0;Maximize"
|
||||
Config_rule_#12 := "Chrome_WidgetWin_1;.*;;1;0;0;0;1;0;Maximize"
|
||||
Config_ruleCount := 12 ;; This variable has to be set to the total number of active rules above.
|
||||
|
||||
;; Configuration management
|
||||
Config_autoSaveSession := False
|
||||
|
|
|
@ -88,10 +88,10 @@ Manager_activateMonitor(d)
|
|||
}
|
||||
}
|
||||
|
||||
Manager_applyRules(wndId, ByRef isManaged, ByRef m, ByRef tags, ByRef isFloating, ByRef isDecorated, ByRef hideTitle)
|
||||
Manager_applyRules(wndId, ByRef isManaged, ByRef m, ByRef tags, ByRef isFloating, ByRef isDecorated, ByRef hideTitle, ByRef action)
|
||||
{
|
||||
Local mouseX, mouseY, wndClass, wndHeight, wndStyle, wndTitle, wndWidth, wndX, wndY
|
||||
Local rule0, rule1, rule2, rule3, rule4, rule5, rule6, rule7, rule8, rule9
|
||||
Local rule0, rule1, rule2, rule3, rule4, rule5, rule6, rule7, rule8, rule9, rule10
|
||||
|
||||
isManaged := True
|
||||
m := 0
|
||||
|
@ -99,6 +99,7 @@ Manager_applyRules(wndId, ByRef isManaged, ByRef m, ByRef tags, ByRef isFloating
|
|||
isFloating := False
|
||||
isDecorated := False
|
||||
hideTitle := False
|
||||
action := ""
|
||||
|
||||
WinGetClass, wndClass, ahk_id %wndId%
|
||||
WinGetTitle, wndTitle, ahk_id %wndId%
|
||||
|
@ -117,6 +118,7 @@ Manager_applyRules(wndId, ByRef isManaged, ByRef m, ByRef tags, ByRef isFloating
|
|||
isFloating := rule7
|
||||
isDecorated := rule8
|
||||
hideTitle := rule9
|
||||
action := rule10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -309,7 +311,7 @@ Manager_loop(index, increment, lowerBound, upperBound)
|
|||
;; Provide a monitor and view preference, but don't override the config.
|
||||
Manager_manage(preferredMonitor, preferredView, wndId)
|
||||
{
|
||||
Local a, c0, hideTitle, i, isDecorated, isFloating, isManaged, l, m, n, replace, search, tags, body
|
||||
Local a, action, c0, hideTitle, i, isDecorated, isFloating, isManaged, l, m, n, replace, search, tags, body
|
||||
Local wndControlList0, wndId0, wndIds, wndX, wndY, wndWidth, wndHeight, wndProcessName
|
||||
|
||||
If Not InStr(Manager_allWndIds, wndId ";")
|
||||
|
@ -328,6 +330,7 @@ Manager_manage(preferredMonitor, preferredView, wndId)
|
|||
isDecorated := Manager_#%body%_isDecorated
|
||||
isFloating := Manager_#%body%_isFloating
|
||||
hideTitle := InStr(Bar_hideTitleWndIds, body ";")
|
||||
action := ""
|
||||
}
|
||||
Else
|
||||
{
|
||||
|
@ -338,7 +341,7 @@ Manager_manage(preferredMonitor, preferredView, wndId)
|
|||
;; Apply rules, if the window is either a normal window or a ghost without a body.
|
||||
If (body = 0)
|
||||
{
|
||||
Manager_applyRules(wndId, isManaged, m, tags, isFloating, isDecorated, hideTitle)
|
||||
Manager_applyRules(wndId, isManaged, m, tags, isFloating, isDecorated, hideTitle, action)
|
||||
If (m = 0)
|
||||
m := preferredMonitor
|
||||
If (m < 0)
|
||||
|
@ -360,6 +363,8 @@ Manager_manage(preferredMonitor, preferredView, wndId)
|
|||
|
||||
If isManaged
|
||||
{
|
||||
If (action = "Close" Or action = "Maximize")
|
||||
Manager_win%action%(wndId)
|
||||
Monitor_moveWindow(m, wndId)
|
||||
|
||||
Manager_managedWndIds .= wndId ";"
|
||||
|
@ -902,6 +907,20 @@ Manager_winHide(wndId)
|
|||
}
|
||||
}
|
||||
|
||||
Manager_winMaximize(wndId)
|
||||
{
|
||||
If Manager_isHung(wndId)
|
||||
{
|
||||
Debug_logMessage("DEBUG[2] Manager_winMaximize: Potentially hung window " . wndId, 2)
|
||||
Return 1
|
||||
}
|
||||
Else
|
||||
{
|
||||
WinMaximize, ahk_id %wndId%
|
||||
Return 0
|
||||
}
|
||||
}
|
||||
|
||||
Manager_winMove(wndId, x, y, width, height)
|
||||
{
|
||||
If Manager_isHung(wndId)
|
||||
|
@ -909,8 +928,12 @@ Manager_winMove(wndId, x, y, width, height)
|
|||
Debug_logMessage("DEBUG[2] Manager_winMove: Potentially hung window " . wndId, 2)
|
||||
Return 1
|
||||
}
|
||||
Else
|
||||
WinRestore, ahk_id %wndId%
|
||||
Else
|
||||
{
|
||||
WinGet, wndMin, MinMax, ahk_id %wndId%
|
||||
If (wndMin = -1)
|
||||
WinRestore, ahk_id %wndId%
|
||||
}
|
||||
WM_ENTERSIZEMOVE = 0x0231
|
||||
WM_EXITSIZEMOVE = 0x0232
|
||||
SendMessage, WM_ENTERSIZEMOVE, , , , ahk_id %wndId%
|
||||
|
|
Loading…
Reference in a new issue