wms/rwm_mainrole.sh

66 lines
971 B
Bash
Raw Normal View History

2023-03-06 19:08:25 +01:00
#!/bin/sh
2023-03-07 14:01:29 +01:00
## give windows the stardom ##
2023-03-06 19:08:25 +01:00
. $HOME/.config/rootwm/rwm_var
2023-03-12 04:54:44 +01:00
FLAG=$1
2023-03-09 20:06:13 +01:00
FW=$(pfw)
2023-03-06 19:08:25 +01:00
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 servers window stack
wid) window id"
}
2023-03-09 20:06:13 +01:00
# 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() {
2023-03-12 04:54:44 +01:00
wattr $FLAG && wid=$FLAG
2023-03-09 20:06:13 +01:00
chwso -r $wid
}
2023-03-12 04:54:44 +01:00
case $FLAG in
2023-03-09 20:06:13 +01:00
-n)
next
2023-03-06 19:08:25 +01:00
;;
2023-03-09 20:06:13 +01:00
-p)
prev
2023-03-06 19:08:25 +01:00
;;
2023-03-09 20:06:13 +01:00
-t)
top
2023-03-06 19:08:25 +01:00
;;
2023-03-09 20:06:13 +01:00
0x*)
on_wid
2023-03-06 19:08:25 +01:00
;;
*)
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