Updated to current
This commit is contained in:
40
misc/bin/nodeselector
Executable file
40
misc/bin/nodeselector
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
clear
|
||||
get_term_size() {
|
||||
IFS='[;' read -sp $'\e7\e[9999;9999H\e[6n\e8' -d R -rs _ lines
|
||||
}
|
||||
listNodes() {
|
||||
for nodeList in $(bspc query -N -n .window | grep -v "$(bspc query -N -n)"); do
|
||||
echo $(xtitle -t 90 ${nodeList})
|
||||
done
|
||||
}
|
||||
getNodes() {
|
||||
count=0
|
||||
for nodeCount in $(bspc query -N -n .window | grep -v "$(bspc query -N -n)"); do
|
||||
count=$((count+1))
|
||||
export node${count}=$nodeCount
|
||||
done
|
||||
selectedNode="node$y"
|
||||
}
|
||||
getCursorPos() {
|
||||
echo -en "\E[6n" && read -sdR CURPOS && CURPOS=${CURPOS#*[} && y=$(printf ";"$CURPOS | cut -d';' -f2)
|
||||
}
|
||||
listNodes
|
||||
printf '\e[H'
|
||||
while [[ true ]]; do
|
||||
read -rsn1 input
|
||||
getCursorPos
|
||||
getNodes
|
||||
if [[ "$input" = "j" && $y -lt $count ]]; then
|
||||
printf '\e[B'
|
||||
elif [[ "$input" = "k" ]]; then
|
||||
printf '\e[A'
|
||||
elif [[ "$input" = "l" ]]; then
|
||||
bspc node --focus ${!selectedNode}
|
||||
clear
|
||||
break
|
||||
elif [[ "$input" = "q" ]]; then
|
||||
clear
|
||||
break
|
||||
fi
|
||||
done
|
Reference in New Issue
Block a user