If I need xwininfo to ID a window by it`s title, the names can be very long ( Geany`s ).
This makes passing the window`s title as an argument almost impossible.
The entire title`s needed to get any info. With a list of all GUIs a search could be done.
I came close with: " xwininfo -root -children " , it does list the gtkdialog windows.
But no title, just the wrong window id for gtkdialog and maybe it`s export variable.
Most of them don`t list gtkdialog`s export variable, oddly Driveman`s is listed.
The first gtkdialog window run gets the id: 0x1000001, the rest get a letter mod.: 0x1e00001
Using -name gets window info, but with the wrong -id the geometry is wrong ( Great...).
Worse yet is that if the window is borderless ( no title ) then there`s no way to get it`s info!
Is there a way to get the GUI`s geometry from the Xwindow id ? Or any other way possible...
Get xwininfo to list data of ALL gtkdialog GUIs? [ Solved ]
Get xwininfo to list data of ALL gtkdialog GUIs? [ Solved ]
Last edited by sunburnt on Fri 23 Apr 2010, 06:37, edited 2 times in total.
### Update: Eureka..! I think I have it! the real gtkdialog window`s last number is always: 3
So this gives a list of the correct id numbers for the gtkdialog GUI`s listed by xwininfo:
So now can get a complete set of geometry for ALL gtkdialog windows.
So this gives a list of the correct id numbers for the gtkdialog GUI`s listed by xwininfo:
Code: Select all
xwinIDs=`xwininfo -root -children |grep gtkdialog3 |awk '{print $1}' |sed 's/1$/3/'`
Here`s a script to get ALL the data for ALL the gtkdialog GUI`s running:
Data for all running gtkdialog GUI`s output to " /tmp/gtkinfo.tmp " is: Title, ID, X, Y, W, H
It adds the prefix of the window`s title to the variable`s name: $GUI_TITLE, $GUI_X, etc.
This uniquely identifies each gtkdialog GUI`s variables in the file to keep them separate.
This should be in a library!
Code: Select all
#!/bin/sh
###### gtkinfo : Get data on gtkdialog GUI`s
gtkIDs=`xwininfo -root -children |grep gtkdialog3 |awk '{print $1}' |sed 's/1$/3/'`
gtkINFO=`echo "$gtkIDs" |while read ID
do
G=($(xwininfo -id $ID |sed '1,9!d'))
T=`echo ${G[4]} |sed 's/"//g'`
((X=G[8]-G[16], Y=G[12]-G[20], W=G[22], H=G[24]))
((X<1)) && ((X=0)); ((Y<1)) && ((Y=0))
echo -e "${T}_TITLE=$T\\n${T}_ID=$ID\\n${T}_X=$X\\n${T}_Y=$Y\\n${T}_W=$W\\n${T}_H=$H\\n"
done` ; eval "$gtkINFO"
It adds the prefix of the window`s title to the variable`s name: $GUI_TITLE, $GUI_X, etc.
This uniquely identifies each gtkdialog GUI`s variables in the file to keep them separate.
This should be in a library!
Last edited by sunburnt on Sun 25 Apr 2010, 00:58, edited 2 times in total.