diff --git a/doc/CHANGES.md b/doc/CHANGES.md index 7d8a836..f890c64 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -6,6 +6,14 @@ * `~` changed * `+` added +### 9.0.2 + +1. `+` Added a function and corresponding hotkey to reset the tile layout of the current view. + +| # | `-` or `~` Configuration Variables or
`-` Hotkey Functions | `+` Configuration Variables or
`+` Hotkey Functions | +| --:| ---------------------------------------------------------------- | --------------------------------------------------------- | +| 1. | | `#^Backspace::View_resetTileLayout()` | + ### 9.0.1 1. `+` Added a cheat sheet for the default hotkeys. diff --git a/doc/Default_hotkeys.md b/doc/Default_hotkeys.md index 932e54f..9a5e159 100644 --- a/doc/Default_hotkeys.md +++ b/doc/Default_hotkeys.md @@ -334,6 +334,14 @@ gap and `View_setLayoutProperty(GapWidth, 20, 0)` will set it to 20px. _Increase the gap between windows_ in "monocle" and "tile" layout. +------------------------------------------------------------------------------- +`Config_hotkey=#^Backspace::View_resetTileLayout()` + +_Reset the tile layout_. + +> This resets the layout and tile layout properties of the currently active +view to the initial (default) values. + ### View / Tag management `Config_hotkey=#+n::View_toggleMargins()` diff --git a/doc/Used_hotkeys.md b/doc/Used_hotkeys.md index bb57590..1f0fa77 100644 --- a/doc/Used_hotkeys.md +++ b/doc/Used_hotkeys.md @@ -11,7 +11,7 @@ keys, which can be used for non-bug.n hotkeys or to reassign bug.n functions. | Up | x | x | x | | x | | | Left | x | x | x | | | | | Right | x | x | x | | | | -| Backspace | x | | | | x | | +| Backspace | x | | x | | x | | | Enter | | x | x | | | x | | Space | x | x | | | | | | Tab | x | | x | x | | | diff --git a/src/Config.ahk b/src/Config.ahk index f53d796..4f6b96a 100644 --- a/src/Config.ahk +++ b/src/Config.ahk @@ -465,6 +465,7 @@ Config_UI_saveSession() { #^Left::View_setLayoutProperty("MX", 0, -1) #+Left::View_setLayoutProperty("GapWidth", 0, -2) #+Right::View_setLayoutProperty("GapWidth", 0, +2) +#^Backspace::View_resetTileLayout() ;; View/Tag management #+n::View_toggleMargins() diff --git a/src/View.ahk b/src/View.ahk index 3c5d62d..5bb9063 100644 --- a/src/View.ahk +++ b/src/View.ahk @@ -250,6 +250,31 @@ View_moveWindow(i=0, d=0) { } } +View_resetTileLayout() { + Local m, v + + m := Manager_aMonitor + v := Monitor_#%m%_aView_#1 + + View_#%m%_#%v%_area_#0 := 0 + View_#%m%_#%v%_layout_#2 := View_#%m%_#%v%_layout_#1 + View_#%m%_#%v%_layout_#1 := 1 + View_#%m%_#%v%_layoutAxis_#1 := Config_layoutAxis_#1 + View_#%m%_#%v%_layoutAxis_#2 := Config_layoutAxis_#2 + View_#%m%_#%v%_layoutAxis_#3 := Config_layoutAxis_#3 + View_#%m%_#%v%_layoutGapWidth := Config_layoutGapWidth + View_#%m%_#%v%_layoutMFact := Config_layoutMFactor + View_#%m%_#%v%_layoutMX := 1 + View_#%m%_#%v%_layoutMY := 1 + View_#%m%_#%v%_layoutSymbol := Config_layoutSymbol_#1 + View_#%m%_#%v%_margins := "0;0;0;0" + View_#%m%_#%v%_showStackArea := True + StringSplit, View_#%m%_#%v%_margin, View_#%m%_#%v%_margins, `; + + If Tiler_isActive(m, v) + View_arrange(m, v) +} + View_setActiveWindow(m, v, wndId) { Global