64 lines
954 B
Bash
Executable file
64 lines
954 B
Bash
Executable file
#!/bin/sh
|
||
|
||
## give windows the stardom ##
|
||
|
||
. $HOME/.config/rootwm/rwm_var
|
||
|
||
FW=$(pfw)
|
||
|
||
usage() {
|
||
echo "usage:
|
||
rwm_starship.sh [ -n, -p, -l, wid ]
|
||
-n) next in order stack
|
||
-p) prev in order stack
|
||
-t) focus the top window in the server’s window stack
|
||
wid) window id"
|
||
}
|
||
|
||
# docus next window in server's window stack order
|
||
next() {
|
||
wid=$(lsw | grep -v $FW | sed '1 p;d')
|
||
chwso -r $wid
|
||
}
|
||
|
||
# focus previous window in in server's window stack order
|
||
prev() {
|
||
wid=$(lsw | grep -v $FW | sed '$ p;d')
|
||
chwso -r $wid
|
||
}
|
||
|
||
# focus the top window in the server's window stack order
|
||
top() {
|
||
wid=$(lsw | sed '$ p;d')
|
||
}
|
||
|
||
# focus on wid
|
||
on_wid() {
|
||
wattr $1 && wid=$1
|
||
chwso -r $wid
|
||
}
|
||
|
||
case $1 in
|
||
-n)
|
||
next
|
||
;;
|
||
-p)
|
||
prev
|
||
;;
|
||
-t)
|
||
top
|
||
;;
|
||
0x*)
|
||
on_wid
|
||
;;
|
||
*)
|
||
usage
|
||
;;
|
||
esac
|
||
|
||
# transfer focus
|
||
wtf $wid
|
||
|
||
# set borders
|
||
chwb -s $BW -c $BG $(lsw | grep -v $(pfw)) # unfocused color
|
||
chwb -s $BW -c $FG $(pfw) # focused color
|