commit 8b5ebb37d52fad70335139583b068589cca1c7f0 Author: Oliver Schraml Date: Thu Jul 12 16:28:31 2018 +0200 i3_selectwindow.sh: init diff --git a/i3_selectwindow.sh b/i3_selectwindow.sh new file mode 100644 index 0000000..291fcc1 --- /dev/null +++ b/i3_selectwindow.sh @@ -0,0 +1,33 @@ +#!/bin/bash +#wmclass=$(i3-msg -t get_tree | jq -r '.' | grep class | grep -v i3bar | sed -e 's/ *//g;s/"class"://g;s/^"//g;s/",$//g' | awk '{print NR, $0}') + +#wmtittle=$(i3-msg -t get_tree | jq -r '.' | grep title | grep -v i3bar | sed -e 's/ *//g;s/"title"://g;s/^"//g;s/",$//g' | awk '{print NR, $0}' | dmenu -l 4) + +#wmNR=$(echo ${wmtittle} | awk '{print $1}') +#wmclass=$(i3-msg -t get_tree | jq -r '.' | grep class | grep -v i3bar | sed -e 's/ *//g;s/"class"://g;s/^"//g;s/",$//g' | awk '{print NR, $0}' | grep -E "^${wmNR} "| sed -e "s/^${wmNR} //g") +#wmtittle=$(echo "${wmtittle}" | sed -e "s/^${wmNR} //g") + +tmpid="" +tmpclass="" +tmptitle="" +choice=$(while IFS= read -r line +do + if ! [ -z "$(echo ${line} | grep -E 'id...[0-9]+')" ] + then + tmpid=$(echo ${line} | grep -Eo "[0-9]+") + fi + + if ! [ -z "$(echo ${line} | grep -v i3bar | grep -E \"class\")" ] + then + tmpclass=$(echo ${line} | grep -E "class" | sed -e 's/ *//g;s/"class"://g;s/^"//g;s/",$//g') + fi + + if ! [ -z "$(echo ${line} | grep -v i3bar | grep -E \"title\")" ] + then + tmptitle=$(echo ${line} | grep -E "title" | sed -e 's/ *//g;s/"title"://g;s/^"//g;s/",$//g') + echo "$tmptitle $tmpclass $tmpid" + fi + +done<<<$(i3-msg -t get_tree | jq -r '.' | grep -B1 "type.*con" -A41 | grep -E "id...[0-9]+|class|title") | dmenu -l 4) + +i3-msg "[con_id="$(echo $choice | awk '{print $3}')"]" focus