xprop > windowpref.tmp;
 
 type=`cat windowpref.tmp | grep _NET_WM_WINDOW_TYPE | cut -d_ -f10`;
-role=`cat windowpref.tmp | grep WM_WINDOW_ROLE | cut -d\" -f2`;
+role=`cat windowpref.tmp | grep _WM_WINDOW_ROLE | cut -d\" -f2`;
 name=`cat windowpref.tmp | grep WM_CLASS | cut -d\" -f2`;
 class=`cat windowpref.tmp | grep WM_CLASS | cut -d\" -f4`;
-title=`cat windowpref.tmp | grep ^WM_NAME | cut -d\" -f2`;
+title=`cat windowpref.tmp | grep "WM_NAME(STRING)" | cut -d\" -f2`;
 xid=`cat windowpref.tmp | grep WM_CLIENT_LEADER | cut -d' ' -f5`;
 
 echo type=$type;
 echo xid=$xid;
 echo state='modal, sticky, maxvert, maxhorz, shaded, skiptaskbar, skippager, hidden, fullscreen, above, below, or demandsattention';
 
-rm windowpref.tmp
+rm windowpref.tmp;