Added the possibility to minimize windows

... excluding them from tiling
+ fixed bug in doc
This commit is contained in:
joten 2015-03-07 22:49:17 +01:00
parent 27ee9d24bd
commit ff3e5ead39
8 changed files with 75 additions and 26 deletions

BIN
bugn.exe

Binary file not shown.

View file

@ -23,6 +23,7 @@ called with the window ID as a paramater, when applying the rule.
8. `~` Revised the default rule set. 8. `~` Revised the default rule set.
9. `+` Added the possibility for sending commands to bug.n from another AutoHotkey script. 9. `+` Added the possibility for sending commands to bug.n from another AutoHotkey script.
10. `~` Removed the function `Main_reload` and reassigned the hotkey. 10. `~` Removed the function `Main_reload` and reassigned the hotkey.
11. `+` Added the possibility to minimize windows, making them floating and thereby excluded from tiling.
| # | Configuration variables | `-` Hotkey functions | `+` Hotkey functions | | # | Configuration variables | `-` Hotkey functions | `+` Hotkey functions |
| ---:| ------------------------- | --------------------------------------- | ----------------------------------------------------- | | ---:| ------------------------- | --------------------------------------- | ----------------------------------------------------- |
@ -82,6 +83,7 @@ called with the window ID as a paramater, when applying the rule.
| | `+` `Config_rule_#17` | | | | | `+` `Config_rule_#17` | | |
| 10. | | `#^r::Main_reload()` | | | 10. | | `#^r::Main_reload()` | |
| | | `#^+r::Reload` | `#^r::Reload` | | | | `#^+r::Reload` | `#^r::Reload` |
| 11. | | | `#^m::Manager_minimizeWindow()` |
### 8.4.0 ### 8.4.0

View file

@ -45,6 +45,9 @@ window list by using the first parameter.
> Toggle the floating status of the active window (i. e. dis- / regard it when > Toggle the floating status of the active window (i. e. dis- / regard it when
tiling). tiling).
`#^m::Manager_minimizeWindow()`
> Minimize the active window; this implicitly makes the window floating.
`#+m::Manager_moveWindow()` `#+m::Manager_moveWindow()`
> Move the active window by key (only floating windows). > Move the active window by key (only floating windows).

View file

@ -31,10 +31,10 @@ There are not many special character keys, which are on both keyboards, US and D
| f | x | x | | | | | | f | x | x | | | | |
| h | | | x | | | | | h | | | x | | | |
| i | x | x | x | x | | | | i | x | x | x | x | | |
| m | x | x | | | | | | m | x | x | x | | | |
| n | | x | | | | | | n | | x | | | | |
| q | | | x | | | | | q | | | x | | | |
| r | | | x | x | | | | r | | | x | | | |
| s | | x | x | | | | | s | | x | x | | | |
| t | x | | x | | | | | t | x | | x | | | |
| x | | x | | | | | | x | | x | | | | |

View file

@ -402,6 +402,7 @@ Config_UI_saveSession() {
#+d::Window_toggleDecor() #+d::Window_toggleDecor()
#+f::View_toggleFloatingWindow() #+f::View_toggleFloatingWindow()
#+m::Manager_moveWindow() #+m::Manager_moveWindow()
#^m::Manager_minimizeWindow()
#+s::Manager_sizeWindow() #+s::Manager_sizeWindow()
#+x::Manager_maximizeWindow() #+x::Manager_maximizeWindow()
#i::Manager_getWindowInfo() #i::Manager_getWindowInfo()

View file

@ -392,6 +392,19 @@ Manager_maximizeWindow() {
Window_move(aWndId, Monitor_#%Manager_aMonitor%_x, Monitor_#%Manager_aMonitor%_y, Monitor_#%Manager_aMonitor%_width, Monitor_#%Manager_aMonitor%_height) Window_move(aWndId, Monitor_#%Manager_aMonitor%_x, Monitor_#%Manager_aMonitor%_y, Monitor_#%Manager_aMonitor%_width, Monitor_#%Manager_aMonitor%_height)
} }
Manager_minimizeWindow() {
Local aView, aWndId
WinGet, aWndId, ID, A
aView := Monitor_#%Manager_aMonitor%_aView_#1
StringReplace, View_#%Manager_aMonitor%_#%aView%_aWndIds, View_#%Manager_aMonitor%_#%aView%_aWndIds, % aWndId ";",, All
If Not Window_#%aWndId%_isFloating
View_toggleFloatingWindow(aWndId)
Window_set(aWndId, "Bottom", "")
Window_minimize(aWndId)
}
Manager_moveWindow() { Manager_moveWindow() {
Local aWndId, SC_MOVE, WM_SYSCOMMAND Local aWndId, SC_MOVE, WM_SYSCOMMAND
@ -475,7 +488,6 @@ Manager_onShellMessage(wParam, lParam) {
;; The current position of the mouse cursor defines the active monitor, if the desktop has been activated. ;; The current position of the mouse cursor defines the active monitor, if the desktop has been activated.
If m If m
Manager_aMonitor := m Manager_aMonitor := m
View_setActiveWindow(Manager_aMonitor, Monitor_#%Manager_aMonitor%_aView_#1, lParam)
Bar_updateTitle() Bar_updateTitle()
} }
@ -567,6 +579,15 @@ Manager_onShellMessage(wParam, lParam) {
} }
} }
If InStr(Manager_managedWndIds, lParam ";") {
View_setActiveWindow(Manager_aMonitor, Monitor_#%Manager_aMonitor%_aView_#1, lParam)
If Window_#%lParam%_isMinimized {
Window_#%lParam%_isFloating := False
Window_#%lParam%_isMinimized := False
View_arrange(Manager_aMonitor, Monitor_#%Manager_aMonitor%_aView_#1)
}
}
;; This is a workaround for a redrawing problem of the bug.n bar, which ;; This is a workaround for a redrawing problem of the bug.n bar, which
;; seems to get lost, when windows are created or destroyed under the ;; seems to get lost, when windows are created or destroyed under the
;; following conditions. ;; following conditions.
@ -579,8 +600,7 @@ Manager_onShellMessage(wParam, lParam) {
Bar_updateView(i, A_Index) Bar_updateView(i, A_Index)
} }
Bar_updateStatus() Bar_updateStatus()
Bar_updateTitle() }
} Else
Bar_updateTitle() Bar_updateTitle()
} }
} }

View file

@ -68,6 +68,7 @@ View_activateWindow(i, d = 0) {
Loop, % wndId0 { Loop, % wndId0 {
Debug_logMessage("DEBUG[2] Next wndId index: " . i, 2, False) Debug_logMessage("DEBUG[2] Next wndId index: " . i, 2, False)
wndId := wndId%i% wndId := wndId%i%
If Not Window_#%wndId%_isMinimized {
Window_set(wndId, "AlwaysOnTop", "On") Window_set(wndId, "AlwaysOnTop", "On")
Window_set(wndId, "AlwaysOnTop", "Off") Window_set(wndId, "AlwaysOnTop", "Off")
@ -75,6 +76,7 @@ View_activateWindow(i, d = 0) {
failure := Manager_winActivate(wndId) failure := Manager_winActivate(wndId)
If Not failure If Not failure
Break Break
}
i := Manager_loop(i, direction, 1, wndId0) i := Manager_loop(i, direction, 1, wndId0)
} }
} }
@ -144,22 +146,28 @@ View_arrange(m, v, setLayout = False) {
} }
View_getActiveWindow(m, v) { View_getActiveWindow(m, v) {
Local wndId Local listId, listIds, wndId
Loop, Parse, View_#%m%_#%v%_aWndIds, `; listIds := "aWndIds;wndIds"
Loop, Parse, listIds, `;
{
listId := A_LoopField
Loop, Parse, View_#%m%_#%v%_%listId%, `;
{ {
If Not A_LoopField If Not A_LoopField
Break Break
Else If Not WinExist("ahk_id" A_LoopField) Else If Not WinExist("ahk_id" A_LoopField) Or Window_#%A_LoopField%_isMinimized
Continue Continue
Else { Else {
wndId := A_LoopField wndId := A_LoopField
Break Break
} }
} }
If Not wndId And View_#%m%_#%v%_wndIds { If wndId {
wndId := SubStr(View_#%m%_#%v%_wndIds, 1, InStr(View_#%m%_#%v%_wndIds, ";") - 1) If (listId = "wndIds")
View_setActiveWindow(m, v, wndId) View_setActiveWindow(m, v, wndId)
Break
}
} }
Return, wndId Return, wndId

View file

@ -165,13 +165,28 @@ Window_maximize(wndId) {
} }
} }
Window_minimize(wndId) {
Global
If Window_isHung(wndId) {
Debug_logMessage("DEBUG[2] Window_minimize: Potentially hung window " . wndId, 2)
Return, 1
} Else {
WinMinimize, ahk_id %wndId%
Window_#%wndId%_isMinimized := True
Return, 0
}
}
Window_move(wndId, x, y, width, height) { Window_move(wndId, x, y, width, height) {
Local wndMinMax, WM_ENTERSIZEMOVE, WM_EXITSIZEMOVE
If Window_isHung(wndId) { If Window_isHung(wndId) {
Debug_logMessage("DEBUG[2] Window_move: Potentially hung window " . wndId, 2) Debug_logMessage("DEBUG[2] Window_move: Potentially hung window " . wndId, 2)
Return, 1 Return, 1
} Else { } Else {
WinGet, wndMin, MinMax, ahk_id %wndId% WinGet, wndMinMax, MinMax, ahk_id %wndId%
If (wndMin = -1) If (wndMinMax = -1 And Not Window_#%wndId%_isMinimized)
WinRestore, ahk_id %wndId% WinRestore, ahk_id %wndId%
} }