From 79acb0f64be97a80a6e85875f1d709a618e80c03 Mon Sep 17 00:00:00 2001 From: rootniformaticaservice Date: Thu, 9 Mar 2023 16:06:13 -0300 Subject: [PATCH] code changes --- rwm_mainrole.sh | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/rwm_mainrole.sh b/rwm_mainrole.sh index fc71dbf..5062a1d 100755 --- a/rwm_mainrole.sh +++ b/rwm_mainrole.sh @@ -4,6 +4,8 @@ . $HOME/.config/rootwm/rwm_var +FW=$(pfw) + usage() { echo "usage: rwm_starship.sh [ -n, -p, -l, wid ] @@ -13,21 +15,41 @@ rwm_starship.sh [ -n, -p, -l, wid ] 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) # focus next in stack order - wid=$(lsw | grep -v $(pfw) | sed '1 p;d') - chwso -r $wid + -n) + next ;; - -p) # focus prev in stack order - wid=$(lsw | grep -v $(pfw) | sed '$ p;d') - chwso -r $wid + -p) + prev ;; - -t) # focus the top window in the server’s window stack - wid=$(lsw | sed '$ p;d') + -t) + top ;; - 0x*) # focus on wid - wattr $1 && wid=$1 - chwso -r $wid + 0x*) + on_wid ;; *) usage