What ever I do $f never seems to be equal to $m but echoing those values tells me that they are the same sometimes
so I expect to do something wrong with if [ "$f" == "$m" ]; where I would expect "Mozilla Firefox" is the same as "Mozilla Firefox"
#!/bin/bash
for i in {1..2}
do
wids=( $(xprop -root | grep '_NET_CLIENT_LIST.*(WINDOW)' | sed 's/^.*#//' | sed 's/,/\n/g' | sort -u ) )
f=`for w in ${wids[@]}; do xprop -id $w | grep -P '^WM_NAME' | grep -i firefox ; done | awk -F "=" '{print $2}'`
echo Active Mozilla Firefox Window Name is $f
echo ""
m="\"Mozilla Firefox"\"
n=`echo "${f}" | sed 's/"//g'`
if [ "$f" == "$m" ];
then
echo "Ihis is a empty firefox tab"
xdotool search "Mozilla Firefox" windowactivate --sync key --clearmodifiers ctrl+w
sleep 1
echo f $f
echo m $m
echo n $n
else
echo "This is not a empty firefox tab"
xdotool search "Mozilla Firefox" windowactivate --sync key --clearmodifiers ctrl+Tab
sleep 1
echo f $f
echo m $m
echo n $n
fi
done
Op dinsdag 3 februari 2015 13:56:26 UTC+1 schreef Jeroen Ruijter:
I found out about Xdotool this weekend and I like it a lot.