diff --git a/doc/CHANGES.md b/doc/CHANGES.md index 079987b..66098b4 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -25,7 +25,7 @@ called with the window ID as a paramater, when applying the rule. 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. 12. `+` Added configuration variables for customizing the date and time format shown in the status bar. -13. `+` Added a function to force the active window to be managed despite any rule in `Config.ini`. +13. `+` Added a function to override the rules applied from `Config.ini` for the active window. | # | `-` or `~` Configuration Variables or
`-` Hotkey Functions | `+` Configuration Variables or
`+` Hotkey Functions | | ---:| ---------------------------------------------------------------- | --------------------------------------------------------- | @@ -88,7 +88,6 @@ called with the window ID as a paramater, when applying the rule. | 11. | | `#^m::Manager_minimizeWindow()` | | 12. | | `Config_readinDateFormat` | | | | `Config_readinTimeFormat` | -| 13. | | `#^+m::Manager_forceManaged()` | ### 8.4.0 diff --git a/doc/Cheat_sheet/Default_hotkeys.md b/doc/Cheat_sheet/Default_hotkeys.md index 8ab3dca..a2520f1 100644 --- a/doc/Cheat_sheet/Default_hotkeys.md +++ b/doc/Cheat_sheet/Default_hotkeys.md @@ -32,9 +32,6 @@ _Minimize_ the active window. #### WinShiftm _Move_ the active window _by key_. -#### WinCtrlShiftm -_Force_ the active window to be _managed_. - #### WinShifts _Resize_ the active window _by key_. diff --git a/doc/Cheat_sheet/cheat_sheet.css b/doc/Cheat_sheet/cheat_sheet.css index 99ea22a..1ffbfc4 100644 --- a/doc/Cheat_sheet/cheat_sheet.css +++ b/doc/Cheat_sheet/cheat_sheet.css @@ -63,8 +63,8 @@ h2 { position: absolute; top: 0; left: 93.5mm; } #window-management { position: absolute; bottom: 0; left: 93.5mm; } #view-tag-management { position: absolute; top: 0; right: 0; } -#gui-management { position: absolute; top: 30.4ex; right: 0; } -#administration { position: absolute; top: 61.3ex; right: 0; } +#gui-management { position: absolute; top: 34.7ex; right: 0; } +#administration { position: absolute; top: 70.2ex; right: 0; } /* 76.5ex - 57.5ex => 19ex / 3 */ #window-debugging { position: absolute; bottom: 0; right: 0; } code { font-family: Ubuntu Mono, monospace; } diff --git a/doc/Cheat_sheet/cheat_sheet.html b/doc/Cheat_sheet/cheat_sheet.html index d70979a..fa171cb 100644 --- a/doc/Cheat_sheet/cheat_sheet.html +++ b/doc/Cheat_sheet/cheat_sheet.html @@ -54,10 +54,6 @@

WinShiftm

Move the active window by key.

-
-

WinCtrlShiftm

-

Force the active window to be managed.

-

WinShifts

Resize the active window by key.

diff --git a/doc/Cheat_sheet/cheat_sheet.pdf b/doc/Cheat_sheet/cheat_sheet.pdf index 99aa12f..2172df1 100644 Binary files a/doc/Cheat_sheet/cheat_sheet.pdf and b/doc/Cheat_sheet/cheat_sheet.pdf differ diff --git a/doc/Default_hotkeys.md b/doc/Default_hotkeys.md index e0a931a..ffd5280 100644 --- a/doc/Default_hotkeys.md +++ b/doc/Default_hotkeys.md @@ -59,19 +59,6 @@ This implicitly sets the window to be floating. This implicitly sets the window to be floating. -`Config_hotkey=#^+m::Manager_forceManaged()` -> _Force_ the active window to be _managed_. - -This function is EXPERIMENTAL, which does not mean that it is in an -alpha-development stage, but you should know what you do, if using this hotkey. - -It forces the flag "is managed" to be true (1) despite any rule in -`Config.ini`. If set improperly, a window, which is not a regular application -window, may only be reset by logging out from and back in to Windows. - -You may also want to use `#+f::View_toggleFloatingWindow()` to see the full -effect. - `Config_hotkey=#+s::Manager_sizeWindow()` > _Resize_ the active window _by key_. diff --git a/doc/Used_hotkeys.md b/doc/Used_hotkeys.md index eaaea57..5b7b346 100644 --- a/doc/Used_hotkeys.md +++ b/doc/Used_hotkeys.md @@ -31,7 +31,7 @@ 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 | x | x | | | +| m | x | x | x | | | | | n | | x | | | | | | q | | | x | | | | | r | | | x | | | | diff --git a/src/Config.ahk b/src/Config.ahk index bd381c0..69cf859 100644 --- a/src/Config.ahk +++ b/src/Config.ahk @@ -406,7 +406,6 @@ Config_UI_saveSession() { #+f::View_toggleFloatingWindow() #+m::Manager_moveWindow() #^m::Manager_minimizeWindow() -#^+m::Manager_forceManaged() #+s::Manager_sizeWindow() #+x::Manager_maximizeWindow() #i::Manager_getWindowInfo() diff --git a/src/Manager.ahk b/src/Manager.ahk index 6a68f38..815d348 100644 --- a/src/Manager.ahk +++ b/src/Manager.ahk @@ -191,19 +191,8 @@ Manager_doMaintenance: Manager_saveState() Return -Manager_forceManaged() { - Local aWndId - - WinGet, aWndId, ID, A - Manager_manage(Manager_aMonitor, Monitor_#%Manager_aMonitor%_aView_#1, aWndId, True) - If Config_dynamicTiling - View_arrange(Manager_aMonitor, Monitor_#%Manager_aMonitor%_aView_#1) - Bar_updateView(Manager_aMonitor, Monitor_#%Manager_aMonitor%_aView_#1) -} - -Manager_getWindowInfo() -{ - Local aWndClass, aWndHeight, aWndId, aWndMinMax, aWndPId, aWndPName, aWndStyle, aWndTitle, aWndWidth, aWndX, aWndY, rule, text, v +Manager_getWindowInfo() { + Local aWndClass, aWndHeight, aWndId, aWndPId, aWndPName, aWndStyle, aWndTitle, aWndWidth, aWndX, aWndY, text, v WinGet, aWndId, ID, A WinGetClass, aWndClass, ahk_id %aWndId% @@ -214,23 +203,12 @@ 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 ";" - If InStr(Manager_managedWndIds, aWndId ";") - rule .= ";1" - Else - rule .= ";0" - rule .= ";" Window_#%aWndId%_monitor ";" Window_#%aWndId%_tags ";" Window_#%aWndId%_isFloating ";" Window_#%aWndId%_isDecorated - If InStr(Bar_hideTitleWndIds, aWndId ";") { - text .= " (hidden)" - rule .= ";1;" - } Else - rule .= ";0;" - If (aWndMinMax = 1) - rule .= "maximize" + If InStr(Bar_hideTitleWndIds, aWndId ";") + text .= " [hidden]" text .= "`nprocess:`t" aWndPName " [" aWndPId "]`nstyle:`t" aWndStyle "`nmetrics:`tx: " aWndX ", y: " aWndY ", width: " aWndWidth ", height: " aWndHeight "`ntags:`t" Window_#%aWndId%_tags If Window_#%aWndId%_isFloating - text .= " (floating)" - text .= "`n`n" rule + text .= " [floating]" + text .= "`n`nConfig_rule=" aWndClass ";" aWndTitle ";;" Manager_getWindowRule(aWndId) MsgBox, 260, bug.n: Window Information, % text "`n`nCopy text to clipboard?" IfMsgBox Yes Clipboard := text @@ -258,6 +236,41 @@ Manager_getWindowList() Clipboard := text } +Manager_getWindowRule(wndId) { + Local rule, wndMinMax + + rule := "" + WinGet, wndMinMax, MinMax, ahk_id %wndId% + If InStr(Manager_managedWndIds, wndId ";") + rule .= "1;" + Else + rule .= "0;" + If (Window_#%wndId%_monitor = "") + rule .= "0;" + Else + rule .= Window_#%wndId%_monitor ";" + If (Window_#%wndId%_tags = "") + rule .= "0;" + Else + rule .= Window_#%wndId%_tags ";" + If Window_#%wndId%_isFloating + rule .= "1;" + Else + rule .= "0;" + If Window_#%wndId%_isDecorated + rule .= "1;" + Else + rule .= "0;" + If InStr(Bar_hideTitleWndIds, wndId ";") + rule .= "1;" + Else + rule .= "0;" + If (wndMinMax = 1) + rule .= "maximize" + + Return, rule +} + Manager_lockWorkStation() { Global Config_shellMsgDelay @@ -283,19 +296,18 @@ Manager_loop(index, increment, lowerBound, upperBound) { Return, lowerBound + lowerBoundBasedIndex } -Manager__setWinProperties(wndId, isManaged, m, tags, isDecorated, isFloating, hideTitle, action = "") -{ +Manager__setWinProperties(wndId, isManaged, m, tags, isDecorated, isFloating, hideTitle, action = "") { Local a - If Not Instr(Manager_allWndIds, wndId ";") + If Not InStr(Manager_allWndIds, wndId ";") Manager_allWndIds .= wndId ";" - If (isManaged) - { - If (action = "close" Or action = "maximize") + If (isManaged) { + If (action = "close" Or action = "maximize" Or action = "restore") Window_%action%(wndId) - Manager_managedWndIds .= wndId ";" + If Not InStr(Manager_managedWndIds, wndId ";") + Manager_managedWndIds .= wndId ";" Monitor_moveWindow(m, wndId) Window_#%wndId%_tags := tags Window_#%wndId%_isDecorated := isDecorated @@ -308,20 +320,17 @@ Manager__setWinProperties(wndId, isManaged, m, tags, isDecorated, isFloating, hi Window_set(wndId, "Style", "-0xC00000") a := Window_#%wndId%_tags & (1 << (Monitor_#%m%_aView_#1 - 1)) - If a - { + If a { ;; A newly created window defines the active monitor, if it is visible. Manager_aMonitor := m Manager_winActivate(wndId) - } - Else - { + } Else { Manager_hideShow := True Window_hide(wndId) Manager_hideShow := False } } - If hideTitle + If hideTitle And Not InStr(Bar_hideTitleWndIds, wndId ";") Bar_hideTitleWndIds .= wndId . ";" Return, a @@ -329,12 +338,13 @@ Manager__setWinProperties(wndId, isManaged, m, tags, isDecorated, isFloating, hi ;; Accept a window to be added to the system for management. ;; Provide a monitor and view preference, but don't override the config. -Manager_manage(preferredMonitor, preferredView, wndId, force = False) { +Manager_manage(preferredMonitor, preferredView, wndId, rule = "") { Local a, action, c0, hideTitle, i, isDecorated, isFloating, isManaged, l, m, n, replace, search, tags, body + Local rule0, rule1, rule2, rule3, rule4, rule5, rule6, rule7 Local wndControlList0, wndId0, wndIds, wndX, wndY, wndWidth, wndHeight ;; Manage any window only once. - If InStr(Manager_allWndIds, wndId ";") And Not force + If InStr(Manager_allWndIds, wndId ";") And (rule = "") Return body := 0 @@ -356,7 +366,16 @@ Manager_manage(preferredMonitor, preferredView, wndId, force = False) { ;; 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, action) - isManaged := isManaged Or force + If Not (rule = "") { + StringSplit, rule, rule, `; + isManaged := rule1 + m := rule2 + tags := rule3 + isFloating := rule4 + isDecorated := rule5 + hideTitle := rule6 + action := rule7 + } If (m = 0) m := preferredMonitor If (m < 0) @@ -609,6 +628,22 @@ Manager_onShellMessage(wParam, lParam) { } } +Manager_override(rule = "") { + Local aWndId, aWndMinMax + + WinGet, aWndId, ID, A + If (rule = "") { + rule := Manager_getWindowRule(aWndId) + InputBox, rule, bug.n: Override, % "Which rule should be applied?`n`n;;;;;;",, 483, 152,,,,, % rule + If Not (ErrorLevel = 0) + Return + } + Manager_manage(Manager_aMonitor, Monitor_#%Manager_aMonitor%_aView_#1, aWndId, rule) + If Config_dynamicTiling + View_arrange(Manager_aMonitor, Monitor_#%Manager_aMonitor%_aView_#1) + Bar_updateView(Manager_aMonitor, Monitor_#%Manager_aMonitor%_aView_#1) +} + Manager_registerShellHook() { WM_DISPLAYCHANGE := 126 ;; This message is sent when the display resolution has changed. Gui, +LastFound diff --git a/src/View.ahk b/src/View.ahk index 4be5317..aeeef79 100644 --- a/src/View.ahk +++ b/src/View.ahk @@ -85,6 +85,7 @@ View_activateWindow(i, d = 0) { View_addWindow(m, v, wndId) { Local i, mSplit, n, replace, search + StringReplace, View_#%m%_#%v%_wndIds, View_#%m%_#%v%_wndIds, % wndId ";",, All If Tiler_isActive(m, v) And ((Config_newWndPosition = "masterBottom") Or (Config_newWndPosition = "stackTop")) { n := View_getTiledWndIds(m, v) mSplit := View_#%m%_#%v%_layoutMX * View_#%m%_#%v%_layoutMY diff --git a/usr/default_01.ini b/usr/default_01.ini index 7803364..8ff0305 100644 --- a/usr/default_01.ini +++ b/usr/default_01.ini @@ -101,7 +101,6 @@ ;Config_hotkey=#+d::Window_toggleDecor() ;Config_hotkey=#+f::View_toggleFloatingWindow() ;Config_hotkey=#+m::Manager_moveWindow() -;Config_hotkey=#^+m::Manager_forceManaged() ;Config_hotkey=#+s::Manager_sizeWindow() ;Config_hotkey=#+x::Manager_maximizeWindow() ;Config_hotkey=#i::Manager_getWindowInfo() diff --git a/usr/joten_01.ini b/usr/joten_01.ini index c2e04e7..f9dc895 100644 --- a/usr/joten_01.ini +++ b/usr/joten_01.ini @@ -109,7 +109,7 @@ Config_hotkey=#k::Manager_closeWindow() ;Config_hotkey=#+d::Window_toggleDecor() ;Config_hotkey=#+f::View_toggleFloatingWindow() ;Config_hotkey=#+m::Manager_moveWindow() -;Config_hotkey=#^+m::Manager_forceManaged() +Config_hotkey=#^o::Manager_override(1;0;0;0;1;0;) ;Config_hotkey=#+s::Manager_sizeWindow() ;Config_hotkey=#+x::Manager_maximizeWindow() Config_hotkey=#i::