Created
April 24, 2016 03:15
-
-
Save SergKolo/6557abd5334d7175a5a387e42fddaebd to your computer and use it in GitHub Desktop.
Getting windows with xprop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_hex_xids() | |
{ | |
xprop -root -notype _NET_CLIENT_LIST | \ | |
awk 'BEGIN{printf "ibase=16"}\ | |
{gsub(/\,/," ");for(i=1;i<=NF;i++) \ | |
if ($i~/0x/) printf ";%s",substr(toupper($i),3) }' | |
} | |
convert_hex2dec() | |
{ | |
HEXIDS=$(get_hex_xids) | |
echo $HEXIDS | bc | |
} | |
print_header() | |
{ | |
printf "%s\t%s\t%s\n" "XID" "TYPE" "TITLE" | |
printf "%s\n" "--------------------------------" | |
} | |
list_info() | |
{ | |
convert_hex2dec | while read line; | |
do | |
TYPE=$( xprop -id $line _NET_WM_WINDOW_TYPE | awk -F '=' '{print $2}' ) | |
if [ $TYPE != "_NET_WM_WINDOW_TYPE_NORMAL" ]; then | |
continue | |
fi | |
CLASS=$(xprop -id $line WM_CLASS | awk -F '=' '{print $2}' ) | |
NAME=$( xprop -id $line _NET_WM_NAME | awk -F '=' '{print $2}' ) | |
printf "\n%s|%s|%s\n" "$line" "$CLASS" "$NAME" | |
done | |
} | |
print_header | |
list_info |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment