From 8b5ebb37d52fad70335139583b068589cca1c7f0 Mon Sep 17 00:00:00 2001 From: Oliver Schraml Date: Thu, 12 Jul 2018 16:28:31 +0200 Subject: [PATCH] i3_selectwindow.sh: init --- i3_selectwindow.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 i3_selectwindow.sh 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