wms/wms_mainrole.sh

66 lines
968 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-20 02:46:41 +01:00
. $HOME/.config/wms/wms_var
2023-03-06 19:08:25 +01:00
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:
2023-03-20 02:46:41 +01:00
wms_mainrole.sh [ -n, -p, -l, wid ]
2023-03-06 19:08:25 +01:00
-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
2023-04-28 15:16:48 +02:00
chwb -s $BW -c $IC $(lsw | grep -v $(pfw)) # unfocused color
chwb -s $BW -c $AC $(pfw) # focused color