code canges. gaps added
This commit is contained in:
parent
b69d057ca8
commit
c860699afd
7 changed files with 113 additions and 85 deletions
|
@ -1,11 +1,12 @@
|
|||
NAME=rootwm # wm name
|
||||
TERM=xterm # terminal command
|
||||
TERMINAL=xterm # terminal command
|
||||
XMENU=fzfmenu.sh # menu command
|
||||
XMENU_XL=fzfmenu_xl.sh # large menu command
|
||||
XMENU_G=60x10+300+300 # menu geometry
|
||||
XMENU_XL_G=80x20+180+180 # large menu geometry
|
||||
BW=2 # border width
|
||||
FG=a0a0a0 # foreground color
|
||||
BG=404040 # background color
|
||||
FG=4DB686
|
||||
BG=144D28
|
||||
WP=80 # windows percentage
|
||||
MP=60 # tiling master area percentage
|
||||
MP=60 # tiling master area percentage
|
||||
GAP=6 # tiling gaps
|
|
@ -10,8 +10,8 @@ FW=$(pfw) # focused window
|
|||
CMW=$(lsw | wc -l) # count maped windows
|
||||
RW=$(wattr w $RID) # root width
|
||||
RH=$(wattr h $RID) # root height
|
||||
SW=$((RW - 2*BW)) # usable screen width
|
||||
SH=$((RH - 2*BW)) # usable screen height
|
||||
SW=$((RW - 2 * BW)) # usable screen width
|
||||
SH=$((RH - 2 * BW)) # usable screen height
|
||||
|
||||
usage() {
|
||||
echo "usage:
|
||||
|
@ -30,37 +30,43 @@ monocule() {
|
|||
|
||||
# tiling. Master and stack
|
||||
tiling() {
|
||||
wunfocus=$((CMW - 1)) # count unfocused windows
|
||||
mp=$(atomx WM_MP $RID) # tiling master area percentage
|
||||
master=$((SW * mp / 100)) # tilling master area
|
||||
wmaster=$((master - 2*BW)) # master width
|
||||
xstack=$master # stack X coordinate
|
||||
ystack=0 # initial stack Y cooordinate
|
||||
wstack=$((SW - master)) # stack width
|
||||
hstack=$(((SH - (wunfocus - 1) * 2*BW) / wunfocus)) # stack heigth
|
||||
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
|
||||
|
||||
wtp 0 0 $wmaster $SH $FW # put focused window as master
|
||||
|
||||
for wid in $(lsw | grep -v $FW); do # unfocused windows in stack
|
||||
wtp $xstack $ystack $wstack $hstack $wid
|
||||
ystack=$((ystack + hstack + 2*BW)) # incremental stack Y corrdinate
|
||||
for wid in $(lsw | grep -v $FW); do # unfocused windows in stack
|
||||
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
|
||||
done
|
||||
}
|
||||
|
||||
# widespread
|
||||
widespread() {
|
||||
wp=$(atomx WM_WP $RID) # window percentage from atom
|
||||
ww=$((SW * wp / 100)) # windows width
|
||||
wh=$((SH * wp / 100)) # windows height
|
||||
x=$(((RW - ww) / (CMW*2))) # initial X coordinate
|
||||
y=$(((RH - wh) / (CMW*2))) # initial Y coordinate
|
||||
xmax=$(((RW - ww) / CMW)) # function X value
|
||||
ymax=$(((RH - wh) / CMW)) # function Y value
|
||||
wp=$(atomx WM_WP $RID) # window percentage from atom
|
||||
ww=$((SW * wp / 100)) # windows width
|
||||
wh=$((SH * wp / 100)) # windows height
|
||||
x=$(((RW - ww) / (CMW * 2))) # initial X coordinate
|
||||
y=$(((RH - wh) / (CMW * 2))) # initial Y coordinate
|
||||
x_max=$(((RW - ww) / CMW)) # function X value
|
||||
y_max=$(((RH - wh) / CMW)) # function Y value
|
||||
|
||||
for wid in $(lsw); do # windows in cascade
|
||||
wtp $x $y $ww $wh $wid
|
||||
x=$((x + xmax)) # incremental X value
|
||||
y=$((y + ymax)) # incremental Y value
|
||||
x=$((x + x_max)) # incremental X value
|
||||
y=$((y + y_max)) # incremental Y value
|
||||
done
|
||||
}
|
||||
|
||||
|
|
30
rwm_gaps.sh
30
rwm_gaps.sh
|
@ -1,30 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
## gaps for tiling arrangement? NFW! ##
|
||||
## I made this script just for compromise ##
|
||||
## It made me so sick that I preferred to segregate the calculation from rwm_arrangement.sh ##
|
||||
## If it is of interest to you, forgive me and please add it. ##
|
||||
## Also this is a dumb way to do it. The implementation in rwm_arrangement.sh is very different ##
|
||||
|
||||
|
||||
FLAG=$1
|
||||
GAPS=$2 # gaps value. can also be: GAPS=$(atomx WM_GAPS $RID) or just GAPS=some_value
|
||||
|
||||
RID=$(lsw -r) # root window id
|
||||
MV=$GAPS # move value
|
||||
RS=$((GAPS * 2)) # resize value
|
||||
|
||||
if [ "$GAPS" -ge 1 ]; then # if gaps is greater than zero
|
||||
for w in $(lsw); do
|
||||
case $FLAG in
|
||||
-i) # increase gaps
|
||||
wmv $MV $MV $w # move window
|
||||
wrs -$RS -$RS $w # resize window
|
||||
;;
|
||||
-d) # decrease gaps
|
||||
wmv -$MV -$MV $w
|
||||
wrs $RS $RS $w
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
. $HOME/.config/rootwm/rwm_var
|
||||
|
||||
FLAG=$1
|
||||
FW=$(pfw)
|
||||
|
||||
usage() {
|
||||
|
@ -34,11 +35,11 @@ top() {
|
|||
|
||||
# focus on wid
|
||||
on_wid() {
|
||||
wattr $1 && wid=$1
|
||||
wattr $FLAG && wid=$FLAG
|
||||
chwso -r $wid
|
||||
}
|
||||
|
||||
case $1 in
|
||||
case $FLAG in
|
||||
-n)
|
||||
next
|
||||
;;
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
## monopolize the screen with the window in focus ##
|
||||
|
||||
. $HOME/.config/rootwm/rwm_var
|
||||
|
||||
FW=$(pfw) # focused window
|
||||
RW=$(wattr w $(lsw -r)) # root width
|
||||
RH=$(wattr h $(lsw -r)) # root height
|
||||
WFW=$((RW - BW * 2)) # window fullsize width
|
||||
WFH=$((RH - BW * 2)) # window fullsize heigh
|
||||
TWF="/tmp/rwm_fullsize-$FW" # temporal window file
|
||||
|
||||
# if it is in the list and it is in fullsize
|
||||
if [ -f "$TWF" ] & [ "$(wattr wh $FW)" = "$WFW $WFH" ]; then
|
||||
wtp $(cat $TWF) $FW # restore size and position
|
||||
rm $TWF # remove from list
|
||||
|
||||
else # if it's not in the list and it's not in fullsize
|
||||
echo "$(wattr xywh $FW)" > $TWF # gets on the list
|
||||
wtp 0 0 $WFW $WFH $FW # gets fullsize
|
||||
|
||||
fi
|
||||
|
|
@ -33,9 +33,26 @@ windowperc_dec() {
|
|||
atomx WM_WP=$((wp -5)) $RID
|
||||
rwm_arrangement.sh -w
|
||||
} # 5% - calculation
|
||||
|
||||
|
||||
gap=$(atomx WM_GAP $RID)
|
||||
gap_inc() {
|
||||
atomx WM_GAP=$((gap + 2)) $RID
|
||||
rwm_arrangement.sh -t
|
||||
} # 5 + pixels gaps
|
||||
|
||||
gap_dec() {
|
||||
atomx WM_GAP=$((gap - 2)) $RID
|
||||
rwm_arrangement.sh -t
|
||||
} # 5 - pixels gaps
|
||||
|
||||
if [ -n "$FLAG" ]; then
|
||||
case $FLAG in
|
||||
-g) # reduce gaps
|
||||
gap_inc
|
||||
;;
|
||||
-G) # increase gaps
|
||||
gap_dec
|
||||
;;
|
||||
-m) # reduce tiling master area
|
||||
master_dec
|
||||
;;
|
||||
|
@ -57,6 +74,7 @@ else
|
|||
atomx WM_NAME=$NAME $RID # set root window name
|
||||
atomx WM_WP=$WP $RID # set window percent atom
|
||||
atomx WM_MP=$MP $RID # set tiling master area percent atom
|
||||
atomx WM_GAP=$GAP $RID # set tiling gaps
|
||||
|
||||
fi
|
||||
|
||||
|
|
56
rwm_screensaver.sh
Executable file
56
rwm_screensaver.sh
Executable file
|
@ -0,0 +1,56 @@
|
|||
#!/bin/sh
|
||||
|
||||
## use the windows on the desktop as screensavers by moving them randomly
|
||||
|
||||
. $HOME/.config/rootwm/rwm_var
|
||||
|
||||
INPUT=$1 # input
|
||||
FW=$(pfw) # focused window
|
||||
SW=$(wattr w $(lsw -r)) # screen width
|
||||
SH=$(wattr h $(lsw -r)) # screen height
|
||||
WW=$((SW * 40 / 100)) # windows width = 80% of the screen
|
||||
WH=$((SH * 40 / 100)) # windows height = 80% of the screen
|
||||
MAXX=$((SW - WW)) # max X coordinate
|
||||
MAXY=$((SH - WH)) # max Y coordinate
|
||||
FREQ=20 # refresh frequency
|
||||
|
||||
usage() {
|
||||
echo "usage:
|
||||
wrm.sh [ -a, -f ]
|
||||
-a) all windows
|
||||
-f) focused window"
|
||||
}
|
||||
|
||||
# random movement for all windowsaver
|
||||
all_win() {
|
||||
while true; do
|
||||
for wid in $(lsw); do
|
||||
x=$(shur -i 0-$MAXX -n 1) # random x coordinate
|
||||
y=$(shur -i 0-$MAXY -n 1) # random y coordinate
|
||||
wtp $x $y $WW $WH $wid
|
||||
done
|
||||
sleep $FREQ
|
||||
done
|
||||
}
|
||||
|
||||
# random movement for the focused window
|
||||
focused_win() {
|
||||
while true; do
|
||||
x=$(shuf -i 0-$MAXX -n 1)
|
||||
y=$(shuf -i 0-$MAXY -n 1)
|
||||
wtp $x $y $WW $WH $FW
|
||||
sleep $FREQ
|
||||
done
|
||||
}
|
||||
|
||||
case $INPUT in
|
||||
-a)
|
||||
all_win
|
||||
;;
|
||||
-f)
|
||||
focused_win
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
Loading…
Reference in a new issue