Revised the rule layout

This commit is contained in:
joten 2015-02-01 20:02:08 +01:00
parent 8ca47284e1
commit d67c7482e9
6 changed files with 29 additions and 25 deletions

View File

@ -18,6 +18,8 @@
5. `~` Revised the interface, i. e. the parameters, of the following functions for setting absolute and relative values -- but did
not implement the functionality: `Monitor_toggleWindowTag`, `View_activateWindow`.
6. `~` Revised the bar color scheme.
7. `~` Revised the rule layout. The third parameter is not compared to the window style anymore, but is a function name, which is
called with the window ID as a paramater, when applying the rule.
| # | Configuration variables | `-` Hotkey functions | `+` Hotkey functions |
| --:| ------------------------- | --------------------------------------- | ----------------------------------------------------- |
@ -62,6 +64,7 @@ not implement the functionality: `Monitor_toggleWindowTag`, `View_activateWindow
| | `+` `Config_fontColor_#1` | | |
| | `+` `Config_fontColor_#2` | | |
| | `+` `Config_fontColor_#3` | | |
| 7. | `~` `Config_rule_#2` | | |
### 8.4.0

View File

@ -11,7 +11,7 @@ following information:
1. class (as a regular expression)
2. title (as a regular expression)
3. window style (as a hexadecimal number or blank)
3. arbitrary criterion (as a function name, e. g. "Window_isPopup", or blank)
With the second part you can give bug.n the following information on how to
handle the identified windows:
@ -28,7 +28,7 @@ removed.
7. A special single window action (`close` or `maximize` or blank).
The general format of a rule added to `Config.ini` is as follows:
`Config_rule=<class>;<title>;<window style>;<is managed>;<monitor>;<views /
`Config_rule=<class>;<title>;<function name>;<is managed>;<monitor>;<views /
tags>;<is floating>;<is decorated>;<hide title>;<action on a single window>`
(all in one line, ";" is not allowed as a character in the field values)

View File

@ -272,9 +272,9 @@ view, not floating (i. e. tiled), the window title bar is not visible, the
title is not hidden on the bug.n status bar and no window action is taken, when
the window first is created.
`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_#2=.*;.*;Window_isPopup;0;0;0;1;1;1;`
> Pop-up windows (style WS_POPUP) 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

View File

@ -78,12 +78,12 @@ Config_init() {
Config_viewFollowsTagged := False
Config_viewMargins := "0;0;0;0"
;; 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_#<i> := '<class>;<title>;<function name>;<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 := ".*;.*;Window_isPopup;0;0;0;1;1;1;" ;; Pop-up windows (style WS_POPUP) 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;"

View File

@ -95,9 +95,8 @@ Manager_activateMonitor(i, d = 0) {
}
}
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
Manager_applyRules(wndId, ByRef isManaged, ByRef m, ByRef tags, ByRef isFloating, ByRef isDecorated, ByRef hideTitle, ByRef action) {
Local mouseX, mouseY, wndClass, wndHeight, wndTitle, wndWidth, wndX, wndY
Local rule0, rule1, rule2, rule3, rule4, rule5, rule6, rule7, rule8, rule9, rule10
isManaged := True
@ -111,14 +110,11 @@ Manager_applyRules(wndId, ByRef isManaged, ByRef m, ByRef tags, ByRef isFloating
WinGetClass, wndClass, ahk_id %wndId%
WinGetTitle, wndTitle, ahk_id %wndId%
WinGetPos, wndX, wndY, wndWidth, wndHeight, ahk_id %wndId%
WinGet, wndStyle, Style, ahk_id %wndId%
If wndClass And wndTitle And Not (wndX < -4999) And Not (wndY < -4999)
{
Loop, % Config_ruleCount
{
If wndClass And wndTitle And Not (wndX < -4999) And Not (wndY < -4999) {
Loop, % Config_ruleCount {
StringSplit, rule, Config_rule_#%A_index%, `;
If RegExMatch(wndClass . ";" . wndTitle, rule1 . ";" . rule2) And (rule3 = "" Or wndStyle & rule3)
{ ;; The last matching rule is returned.
If RegExMatch(wndClass . ";" . wndTitle, rule1 . ";" . rule2) And (rule3 = "" Or %rule3%(wndId)) {
;; The last matching rule is returned.
isManaged := rule4
m := rule5
tags := rule6
@ -128,9 +124,7 @@ Manager_applyRules(wndId, ByRef isManaged, ByRef m, ByRef tags, ByRef isFloating
action := rule10
}
}
}
Else
{
} Else {
isManaged := False
If wndTitle
hideTitle := True
@ -223,7 +217,7 @@ Manager_getWindowInfo()
WinGet, aWndMinMax, MinMax, ahk_id %aWndId%
WinGetPos, aWndX, aWndY, aWndWidth, aWndHeight, ahk_id %aWndId%
text := "ID: " aWndId "`nclass:`t" aWndClass "`ntitle:`t" aWndTitle
rule := "Config_rule=" aWndClass ";" aWndTitle ";" aWndStyle
rule := "Config_rule=" aWndClass ";" aWndTitle ";"
If InStr(Manager_managedWndIds, aWndId ";")
rule .= ";1"
Else

View File

@ -96,6 +96,13 @@ Window_isHung(wndId) {
Return, 0
}
Window_isPopup(wndId) {
WS_POPUP = 0x80000000
WinGet, wndStyle, Style, ahk_id %wndId%
Return, wndStyle & WS_POPUP
}
Window_isProg(wndId) {
WinGetClass, wndClass, ahk_id %wndId%
WinGetTitle, wndTitle, ahk_id %wndId%