diff --git a/bugn.exe b/bugn.exe index ba9d291..ad74993 100644 Binary files a/bugn.exe and b/bugn.exe differ diff --git a/doc/CHANGES.md b/doc/CHANGES.md index 846a55e..3b1b80b 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -23,6 +23,7 @@ called with the window ID as a paramater, when applying the rule. 8. `~` Revised the default rule set. 9. `+` Added the possibility for sending commands to bug.n from another AutoHotkey script. 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 | | ---:| ------------------------- | --------------------------------------- | ----------------------------------------------------- | @@ -82,6 +83,7 @@ called with the window ID as a paramater, when applying the rule. | | `+` `Config_rule_#17` | | | | 10. | | `#^r::Main_reload()` | | | | | `#^+r::Reload` | `#^r::Reload` | +| 11. | | | `#^m::Manager_minimizeWindow()` | ### 8.4.0 diff --git a/doc/Default_hotkeys.md b/doc/Default_hotkeys.md index 26a2332..59335f8 100644 --- a/doc/Default_hotkeys.md +++ b/doc/Default_hotkeys.md @@ -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 tiling). +`#^m::Manager_minimizeWindow()` +> Minimize the active window; this implicitly makes the window floating. + `#+m::Manager_moveWindow()` > Move the active window by key (only floating windows). diff --git a/doc/Used_hotkeys.md b/doc/Used_hotkeys.md index 3059e18..5b7b346 100644 --- a/doc/Used_hotkeys.md +++ b/doc/Used_hotkeys.md @@ -31,10 +31,10 @@ There are not many special character keys, which are on both keyboards, US and D | f | x | x | | | | | | h | | | x | | | | | i | x | x | x | x | | | -| m | x | x | | | | | +| m | x | x | x | | | | | n | | x | | | | | | q | | | x | | | | -| r | | | x | x | | | +| r | | | x | | | | | s | | x | x | | | | | t | x | | x | | | | | x | | x | | | | | diff --git a/src/Config.ahk b/src/Config.ahk index b9eb444..abb189d 100644 --- a/src/Config.ahk +++ b/src/Config.ahk @@ -402,6 +402,7 @@ Config_UI_saveSession() { #+d::Window_toggleDecor() #+f::View_toggleFloatingWindow() #+m::Manager_moveWindow() +#^m::Manager_minimizeWindow() #+s::Manager_sizeWindow() #+x::Manager_maximizeWindow() #i::Manager_getWindowInfo() diff --git a/src/Manager.ahk b/src/Manager.ahk index 7df4f82..91dbfb0 100644 --- a/src/Manager.ahk +++ b/src/Manager.ahk @@ -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) } +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() { 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. If m Manager_aMonitor := m - View_setActiveWindow(Manager_aMonitor, Monitor_#%Manager_aMonitor%_aView_#1, lParam) 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 ;; seems to get lost, when windows are created or destroyed under the ;; following conditions. @@ -579,9 +600,8 @@ Manager_onShellMessage(wParam, lParam) { Bar_updateView(i, A_Index) } Bar_updateStatus() - Bar_updateTitle() - } Else - Bar_updateTitle() + } + Bar_updateTitle() } } diff --git a/src/View.ahk b/src/View.ahk index 5429705..24b3568 100644 --- a/src/View.ahk +++ b/src/View.ahk @@ -68,13 +68,15 @@ View_activateWindow(i, d = 0) { Loop, % wndId0 { Debug_logMessage("DEBUG[2] Next wndId index: " . i, 2, False) wndId := wndId%i% - Window_set(wndId, "AlwaysOnTop", "On") - Window_set(wndId, "AlwaysOnTop", "Off") + If Not Window_#%wndId%_isMinimized { + Window_set(wndId, "AlwaysOnTop", "On") + Window_set(wndId, "AlwaysOnTop", "Off") - ;; If there are hung windows on the screen, we still want to be able to cycle through them. - failure := Manager_winActivate(wndId) - If Not failure - Break + ;; If there are hung windows on the screen, we still want to be able to cycle through them. + failure := Manager_winActivate(wndId) + If Not failure + Break + } i := Manager_loop(i, direction, 1, wndId0) } } @@ -144,23 +146,29 @@ View_arrange(m, v, setLayout = False) { } View_getActiveWindow(m, v) { - Local wndId + Local listId, listIds, wndId - Loop, Parse, View_#%m%_#%v%_aWndIds, `; + listIds := "aWndIds;wndIds" + Loop, Parse, listIds, `; { - If Not A_LoopField - Break - Else If Not WinExist("ahk_id" A_LoopField) - Continue - Else { - wndId := A_LoopField + listId := A_LoopField + Loop, Parse, View_#%m%_#%v%_%listId%, `; + { + If Not A_LoopField + Break + Else If Not WinExist("ahk_id" A_LoopField) Or Window_#%A_LoopField%_isMinimized + Continue + Else { + wndId := A_LoopField + Break + } + } + If wndId { + If (listId = "wndIds") + View_setActiveWindow(m, v, wndId) Break } } - If Not wndId And View_#%m%_#%v%_wndIds { - wndId := SubStr(View_#%m%_#%v%_wndIds, 1, InStr(View_#%m%_#%v%_wndIds, ";") - 1) - View_setActiveWindow(m, v, wndId) - } Return, wndId } diff --git a/src/Window.ahk b/src/Window.ahk index d950d81..0afd746 100644 --- a/src/Window.ahk +++ b/src/Window.ahk @@ -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) { + Local wndMinMax, WM_ENTERSIZEMOVE, WM_EXITSIZEMOVE + If Window_isHung(wndId) { Debug_logMessage("DEBUG[2] Window_move: Potentially hung window " . wndId, 2) Return, 1 } Else { - WinGet, wndMin, MinMax, ahk_id %wndId% - If (wndMin = -1) + WinGet, wndMinMax, MinMax, ahk_id %wndId% + If (wndMinMax = -1 And Not Window_#%wndId%_isMinimized) WinRestore, ahk_id %wndId% }