diff --git a/doc/CHANGES.md b/doc/CHANGES.md index 28675a1..21ffe62 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -14,7 +14,7 @@ `View_setMY` and `View_rotateLayoutAxis` 4. `~` Revised the following functions to allow setting absolute and relative values: `Debug_setLogLevel`, `Manager_activateMonitor`, `Manager_setViewMonitor`, `Manager_setWindowMonitor`, `Monitor_activateView`, `Monitor_setWindowTag`, -`View_setLayout`, `View_setMFactor`, `View_shuffleWindow` +`View_setGapWidth`, `View_setLayout`, `View_setMFactor`, `View_shuffleWindow` 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` diff --git a/doc/Default_hotkeys.md b/doc/Default_hotkeys.md index ae17db2..1480280 100644 --- a/doc/Default_hotkeys.md +++ b/doc/Default_hotkeys.md @@ -128,20 +128,20 @@ the default configuration). `#Left::View_setLayoutProperty("MFactor", 0, -0.05)` > Reduce the size of the master area in the active view (only for the "tile" layout). You may also set an additional parameter for accelerating the third -one. E. g. with `#Left::View_setLayoutProperty("MFactor", 0, -0.05, 2)` the +one. E. g. with `#Left::View_setLayoutProperty(MFactor, 0, -0.05, 2)` the first step, by which the master area is reduced, is -0.0016% and will be doubled with consecutive calls until it reaches -0.05%. With the second parameter you may set an absolute value, e. g. -'View_setLayoutProperty("MFactor", 0.5, 0)' splits the view in half. +'View_setLayoutProperty(MFactor, 0.5, 0)' splits the view in half. `#Right::View_setLayoutProperty("MFactor", 0, +0.05)` > Enlarge the size of the master area in the active view (only for the "tile" layout). You may also set a additional parameter for accelerating the third -one. E. g. with `#Right::View_setLayoutProperty("MFactor", 0, +0.05, 0.5)` the +one. E. g. with `#Right::View_setLayoutProperty(MFactor, 0, +0.05, 0.5)` the first step, by which the master area is reduced, is 0.05%, but with consecutive calls it will be halved until it reaches 0.0016%. With the second parameter you may set an absolute value, e. g. -'View_setLayoutProperty("MFactor", 0.67, 0)' makes the master area two thirds +'View_setLayoutProperty(MFactor, 0.67, 0)' makes the master area two thirds and the stacking area one third the size of the view. `#^t::View_setLayoutProperty("Axis", 0, +1, 1)` @@ -177,7 +177,10 @@ the master area by Y. Maximum of 9 (only for the "tile" layout). the master area by Y. Minimum of 1 (only for the "tile" layout). `#+Left::View_setLayoutProperty("GapWidth", 0, -2)` -> Decrease the gap between windows in "monocle" and "tile" layout. +> Decrease the gap between windows in "monocle" and "tile" layout. You may also +set an absolute value for the gap width by using the first parameter, e. g. +`View_setLayoutProperty(GapWidth, 0, 0)` will eliminate the gap and +`View_setLayoutProperty(GapWidth, 20, 0)` will set it to 20px. `#+Right::View_setLayoutProperty("GapWidth", 0, +2)` > Increase the gap between windows in "monocle" and "tile" layout. diff --git a/src/Main.ahk b/src/Main.ahk index 09e4da7..803518b 100644 --- a/src/Main.ahk +++ b/src/Main.ahk @@ -101,14 +101,16 @@ Main_evalCommand(command) { functionName := SubStr(command, 1, i - 1) functionArguments := SubStr(command, i + 1, j - (i + 1)) + StringReplace, functionArguments, functionArguments, %A_SPACE%, , All StringSplit, functionArgument, functionArguments, `, If (functionArgument0 < 2) %functionName%(functionArguments) Else If (functionArgument0 = 2) - { - StringTrimLeft, functionArgument2, functionArgument2, 1 %functionName%(functionArgument1, functionArgument2) - } + Else If (functionArgument0 = 3) + %functionName%(functionArgument1, functionArgument2, functionArgument3) + Else If (functionArgument0 = 4) + %functionName%(functionArgument1, functionArgument2, functionArgument3, functionArgument4) } } } diff --git a/src/View.ahk b/src/View.ahk index c3659bc..0b725a8 100644 --- a/src/View.ahk +++ b/src/View.ahk @@ -197,25 +197,19 @@ View_moveWindow(i=0, d=0) { } } -View_setGapWidth(d) -{ - Local l, v, w +View_setGapWidth(i, d = 0) { + Local v v := Monitor_#%Manager_aMonitor%_aView_#1 - l := View_#%Manager_aMonitor%_#%v%_layout_#1 - If Tiler_isActive(Manager_aMonitor, v) Or (Config_layoutFunction_#%l% = "monocle") - { - If (d < 0) - d := Floor(d / 2) * 2 - Else - d := Ceil(d / 2) * 2 - w := View_#%Manager_aMonitor%_#%v%_layoutGapWidth + d - If (w < Monitor_#%Manager_aMonitor%_height And w < Monitor_#%Manager_aMonitor%_width) - { - View_#%Manager_aMonitor%_#%v%_layoutGapWidth := w - View_arrange(Manager_aMonitor, v) - } - } + If (i = 0) And (d != 0) + i := View_#%Manager_aMonitor%_#%v%_layoutGapWidth + i += d + If (i >= 0 And i < Monitor_#%Manager_aMonitor%_height And i < Monitor_#%Manager_aMonitor%_width) { + i := Ceil(i / 2) * 2 + View_#%Manager_aMonitor%_#%v%_layoutGapWidth := i + Return, 1 + } Else + Return, 0 } View_setLayout(i, d = 0) { @@ -237,9 +231,10 @@ View_setLayout(i, d = 0) { } View_setLayoutProperty(name, i, d, opt = 0) { - Local a, v + Local a, l, v v := Monitor_#%Manager_aMonitor%_aView_#1 + l := View_#%Manager_aMonitor%_#%v%_layout_#1 If Tiler_isActive(Manager_aMonitor, v) { If (name = "Axis") a := Tiler_setAxis(Manager_aMonitor, v, opt, d) @@ -247,16 +242,16 @@ View_setLayoutProperty(name, i, d, opt = 0) { If (opt = 0) opt := 1 a := Tiler_setMFactor(Manager_aMonitor, v, i, d, opt) - } Else If (name = "GapWidth") - View_setGapWidth(d) - Else If (name = "MX") + } Else If (name = "MX") a := Tiler_setMX(Manager_aMonitor, v, d) Else If (name = "MY") a := Tiler_setMY(Manager_aMonitor, v, d) - - If a - View_arrange(Manager_aMonitor, v) } + If (name = "GapWidth") And (Tiler_isActive(Manager_aMonitor, v) Or (Config_layoutFunction_#%l% = "monocle")) + a := View_setGapWidth(i, d) + + If a + View_arrange(Manager_aMonitor, v) } View_shuffleWindow(i, d = 0) {