finally a moderately well calculated tiling

This commit is contained in:
rootniformaticaservice 2023-04-14 00:18:41 -03:00
parent 907e688011
commit c1e749b19b
1 changed files with 22 additions and 19 deletions

View File

@ -30,26 +30,28 @@ monocule() {
# tiling. Master and stack
tiling() {
gap=$(atomx WM_GAP $RID) # gaps
sw=$((RW - 2 * gap - 2 * BW)) # screen widht width gaps added
sh=$((RH - 2 * gap - 2 * BW)) # screen height width gaps added
u_wind=$((CMW - 1)) # calculate unfocused windows
m_perc=$(atomx WM_MP $RID) # master area percent
m_width=$((sw * m_perc / 100 - 2 * BW)) # master area width
m_height=$sh # master area height
mx=$gap # master x coordinate
my=$gap # master y coordinate
s_width=$((sw - m_width - gap - 2 * BW)) # stack width
s_height=$((sh / u_wind)) # stack height
sx=$((m_width + 2 * gap + 2 * BW)) # stack X coordinate
sy=$gap # stack Y coordinate
wtp $mx $my $m_width $m_height $FW # put focused window as master
gap=$(atomx WM_GAP $RID) # gaps
sw=$((RW - 2 * gap - 2 * BW)) # screen widht width gaps added
msh=$((RH - 2 * gap - 2 * BW)) # master screen height
ssh=$((RH - gap - BW)) # stack screen height
sw_count=$((CMW - 1)) # stack windows count
m_perc=$(atomx WM_MP $RID) # master area percent
m_width=$((sw * m_perc / 100 - 2 * BW)) # master area width
m_height=$msh # master area height
mx=$gap # master x coordinate
my=$gap # master y coordinate
s_width=$((sw - m_width - gap - 2 * BW)) # stack width
s_height=$((ssh / sw_count - gap - 2 * BW)) # stack height
sx=$((m_width + 2 * gap + 2 * BW)) # stack x coordinate
sy=$gap # stack y coordinate
for wid in $(lsw | grep -v $FW); do # unfocused windows in stack
# put focused window as master
wtp $mx $my $m_width $m_height $FW
# put the rest of the windows in stack
for wid in $(lsw | grep -v $FW); do
wtp $sx $sy $s_width $s_height $wid
sy=$((sy + s_height + gap + 2 * BW)) # incremental Y coordinate
s_height=$((sh / u_wind - gap - 2 * BW)) # new stack height calculation
sy=$((sy + s_height + gap + 2 * BW)) # incremental stack y coordinate
done
}
@ -63,7 +65,8 @@ widespread() {
x_max=$(((RW - ww) / CMW)) # function X value
y_max=$(((RH - wh) / CMW)) # function Y value
for wid in $(lsw); do # windows in cascade
# put windows in cascade
for wid in $(lsw); do
wtp $x $y $ww $wh $wid
x=$((x + x_max)) # incremental X value
y=$((y + y_max)) # incremental Y value