added gaps for the "tile" layout (Config_layoutGapWidth and View_setGapWidth(d))

This commit is contained in:
joten 2012-06-01 14:22:45 +02:00
parent 09676ce755
commit c6ad84087f
2 changed files with 47 additions and 22 deletions

View file

@ -57,6 +57,7 @@ Config_init() {
Config_layoutAxis_#1 := 1 ; The layout axis: 1 = x, 2 = y; negative values mirror the layout, setting the master area to the right / bottom instead of left / top. Config_layoutAxis_#1 := 1 ; The layout axis: 1 = x, 2 = y; negative values mirror the layout, setting the master area to the right / bottom instead of left / top.
Config_layoutAxis_#2 := 2 ; The master axis: 1 = x (from left to right), 2 = y (from top to bottom), 3 = z (monocle). Config_layoutAxis_#2 := 2 ; The master axis: 1 = x (from left to right), 2 = y (from top to bottom), 3 = z (monocle).
Config_layoutAxis_#3 := 2 ; The stack axis: 1 = x (from left to right), 2 = y (from top to bottom), 3 = z (monocle). Config_layoutAxis_#3 := 2 ; The stack axis: 1 = x (from left to right), 2 = y (from top to bottom), 3 = z (monocle).
Config_layoutGapWidth := 0 ; The default gap width in px (only even numbers) of the "tile" layout, i. e. the space between windows and around the layout.
Config_layoutMFactor := 0.6 ; The factor for the size of the master area, which is multiplied by the monitor size. Config_layoutMFactor := 0.6 ; The factor for the size of the master area, which is multiplied by the monitor size.
Config_mouseFollowsFocus := True ; If true, the mouse pointer is set over the focused window, if a window is activated by bug.n. Config_mouseFollowsFocus := True ; If true, the mouse pointer is set over the focused window, if a window is activated by bug.n.
Config_onActiveHiddenWnds := "view" ; The action, which will be taken, if a window e. g. should be activated, but is not visible; "view": show the view accordng to the first tag of the window in question, "tag": add the window in question to the current visible view, "hide": hide the window again ignoring the activation. Config_onActiveHiddenWnds := "view" ; The action, which will be taken, if a window e. g. should be activated, but is not visible; "view": show the view accordng to the first tag of the window in question, "tag": add the window in question to the current visible view, "hide": hide the window again ignoring the activation.
@ -334,6 +335,8 @@ Config_saveSession() {
text .= "View_#" m "_#" A_Index "_layoutAxis_#2=" View_#%m%_#%A_Index%_layoutAxis_#2 "`n" text .= "View_#" m "_#" A_Index "_layoutAxis_#2=" View_#%m%_#%A_Index%_layoutAxis_#2 "`n"
If Not (View_#%m%_#%A_Index%_layoutAxis_#3 = Config_layoutAxis_#3) If Not (View_#%m%_#%A_Index%_layoutAxis_#3 = Config_layoutAxis_#3)
text .= "View_#" m "_#" A_Index "_layoutAxis_#3=" View_#%m%_#%A_Index%_layoutAxis_#3 "`n" text .= "View_#" m "_#" A_Index "_layoutAxis_#3=" View_#%m%_#%A_Index%_layoutAxis_#3 "`n"
If Not (View_#%m%_#%A_Index%_layoutGapWidth = Config_layoutGapWidth)
text .= "View_#" m "_#" A_Index "_layoutGapWidth=" View_#%m%_#%A_Index%_layoutGapWidth "`n"
If Not (View_#%m%_#%A_Index%_layoutMFact = Config_layoutMFactor) If Not (View_#%m%_#%A_Index%_layoutMFact = Config_layoutMFactor)
text .= "View_#" m "_#" A_Index "_layoutMFact=" View_#%m%_#%A_Index%_layoutMFact "`n" text .= "View_#" m "_#" A_Index "_layoutMFact=" View_#%m%_#%A_Index%_layoutMFact "`n"
If Not (View_#%m%_#%A_Index%_layoutMSplit = 1) If Not (View_#%m%_#%A_Index%_layoutMSplit = 1)
@ -376,6 +379,8 @@ Config_saveSession() {
#^+Tab::View_rotateLayoutAxis(3, +1) ; Rotate the stack axis (i. e. 3 -> 1 = x-axis = horizontal stack, 1 -> 2 = y-axis = vertical stack, 2 -> 3 = z-axis = monocle, only for the "tile" layout). #^+Tab::View_rotateLayoutAxis(3, +1) ; Rotate the stack axis (i. e. 3 -> 1 = x-axis = horizontal stack, 1 -> 2 = y-axis = vertical stack, 2 -> 3 = z-axis = monocle, only for the "tile" layout).
#^Left::View_setMSplit(+1) ; Move the master splitter, i. e. decrease the number of windows in the master area (only for the "tile" layout). #^Left::View_setMSplit(+1) ; Move the master splitter, i. e. decrease the number of windows in the master area (only for the "tile" layout).
#^Right::View_setMSplit(-1) ; Move the master splitter, i. e. increase the number of windows in the master area (only for the "tile" layout). #^Right::View_setMSplit(-1) ; Move the master splitter, i. e. increase the number of windows in the master area (only for the "tile" layout).
#<::View_setGapWidth(-2) ; Decrease the gap width by 2 px (only for the "tile" layout and even numbers; see the variable "Config_layoutGapWidth").
#+<::View_setGapWidth(+2) ; Increase the gap width by 2 px (only for the "tile" layout and even numbers; see the variable "Config_layoutGapWidth").
#BackSpace::Monitor_activateView(-1) ; Activate the previously activated view. You may also use Monitor_activateView("<") or Monitor_activateView(">") for activating the previous or next adjacent view. #BackSpace::Monitor_activateView(-1) ; Activate the previously activated view. You may also use Monitor_activateView("<") or Monitor_activateView(">") for activating the previous or next adjacent view.
#+0::Monitor_setWindowTag(0) ; Tag the active window with all tags (1 ... Config_viewCount). You may also use Monitor_setWindowTag("<") or Monitor_setWindowTag(">") for setting the tag of the previous or next adjacent to the current view. #+0::Monitor_setWindowTag(0) ; Tag the active window with all tags (1 ... Config_viewCount). You may also use Monitor_setWindowTag("<") or Monitor_setWindowTag(">") for setting the tag of the previous or next adjacent to the current view.

View file

@ -27,6 +27,7 @@ View_init(m, v) {
View_#%m%_#%v%_layoutAxis_#1 := Config_layoutAxis_#1 View_#%m%_#%v%_layoutAxis_#1 := Config_layoutAxis_#1
View_#%m%_#%v%_layoutAxis_#2 := Config_layoutAxis_#2 View_#%m%_#%v%_layoutAxis_#2 := Config_layoutAxis_#2
View_#%m%_#%v%_layoutAxis_#3 := Config_layoutAxis_#3 View_#%m%_#%v%_layoutAxis_#3 := Config_layoutAxis_#3
View_#%m%_#%v%_layoutGapWidth := Config_layoutGapWidth
View_#%m%_#%v%_layoutMFact := Config_layoutMFactor View_#%m%_#%v%_layoutMFact := Config_layoutMFactor
View_#%m%_#%v%_layoutMSplit := 1 View_#%m%_#%v%_layoutMSplit := 1
View_#%m%_#%v%_layoutSymbol := Config_layoutSymbol_#1 View_#%m%_#%v%_layoutSymbol := Config_layoutSymbol_#1
@ -112,6 +113,24 @@ View_rotateLayoutAxis(i, d) {
} }
} }
View_setGapWidth(d) {
Local l, v, w
v := Monitor_#%Manager_aMonitor%_aView_#1
l := View_#%Manager_aMonitor%_#%v%_layout_#1
If (Config_layoutFunction_#%l% = "tile") {
If (d < 0)
d := Floor(d / 2) * 2
Else
d := Ceil(d / 2) * 2
w := View_#%Manager_aMonitor%_#%v%_layoutGapWidth + d
If (w >= 0 And w < Monitor_#%Manager_aMonitor%_height And w < Monitor_#%Manager_aMonitor%_width) {
View_#%Manager_aMonitor%_#%v%_layoutGapWidth := w
View_arrange(Manager_aMonitor, v)
}
}
}
View_setLayout(l) { View_setLayout(l) {
Local v Local v
@ -201,11 +220,12 @@ View_shuffleWindow(d) {
} }
View_tile(m, v, wndIds) { View_tile(m, v, wndIds) {
Local axis1, axis2, axis3, h1, h2, i, mfact, msplit, n1, n2, sym1, sym3, w1, w2, wndId0, x1, x2, y1, y2 Local axis1, axis2, axis3, gapW, h1, h2, i, mfact, msplit, n1, n2, sym1, sym3, w1, w2, wndId0, x1, x2, y1, y2
axis1 := View_#%m%_#%v%_layoutAxis_#1 axis1 := View_#%m%_#%v%_layoutAxis_#1
axis2 := View_#%m%_#%v%_layoutAxis_#2 axis2 := View_#%m%_#%v%_layoutAxis_#2
axis3 := View_#%m%_#%v%_layoutAxis_#3 axis3 := View_#%m%_#%v%_layoutAxis_#3
gapW := View_#%m%_#%v%_layoutGapWidth
mfact := View_#%m%_#%v%_layoutMFact mfact := View_#%m%_#%v%_layoutMFact
msplit := View_#%m%_#%v%_layoutMSplit msplit := View_#%m%_#%v%_layoutMSplit
@ -249,14 +269,14 @@ View_tile(m, v, wndIds) {
If (wndId0 > 0) { If (wndId0 > 0) {
; master and stack area ; master and stack area
h1 := Monitor_#%m%_height h1 := Monitor_#%m%_height - gapW
h2 := Monitor_#%m%_height h2 := Monitor_#%m%_height - gapW
w1 := Monitor_#%m%_width w1 := Monitor_#%m%_width - gapW
w2 := Monitor_#%m%_width w2 := Monitor_#%m%_width - gapW
x1 := Monitor_#%m%_x x1 := Monitor_#%m%_x + gapW / 2
x2 := Monitor_#%m%_x x2 := Monitor_#%m%_x + gapW / 2
y1 := Monitor_#%m%_y y1 := Monitor_#%m%_y + gapW / 2
y2 := Monitor_#%m%_y y2 := Monitor_#%m%_y + gapW / 2
If (Abs(axis1) = 1 And wndId0 > msplit) { If (Abs(axis1) = 1 And wndId0 > msplit) {
w1 *= mfact w1 *= mfact
w2 -= w1 w2 -= w1
@ -283,7 +303,7 @@ View_tile(m, v, wndIds) {
Else Else
n2 := msplit n2 := msplit
Loop, % msplit { Loop, % msplit {
Manager_winMove(wndId%A_Index%, x1, y1, w1 / n1, h1 / n2) Manager_winMove(wndId%A_Index%, x1 + gapW / 2, y1 + gapW / 2, w1 / n1 - gapW, h1 / n2 - gapW)
If (n1 > 1) If (n1 > 1)
x1 += w1 / n1 x1 += w1 / n1
If (n2 > 1) If (n2 > 1)
@ -302,7 +322,7 @@ View_tile(m, v, wndIds) {
n2 := wndId0 - msplit n2 := wndId0 - msplit
Loop, % wndId0 - msplit { Loop, % wndId0 - msplit {
i := msplit + A_Index i := msplit + A_Index
Manager_winMove(wndId%i%, x2, y2, w2 / n1, h2 / n2) Manager_winMove(wndId%i%, x2 + gapW / 2, y2 + gapW / 2, w2 / n1 - gapW, h2 / n2 - gapW)
If (n1 > 1) If (n1 > 1)
x2 += w2 / n1 x2 += w2 / n1
If (n2 > 1) If (n2 > 1)