The time now is Fri 06 Dec 2019, 07:18
All times are UTC - 4 |
Author |
Message |
sunburnt

Joined: 08 Jun 2005 Posts: 5087 Location: Arizona, U.S.A.
|
Posted: Thu 22 Apr 2010, 22:46 Post subject:
Get xwininfo to list data of ALL gtkdialog GUIs? [ Solved ] |
|
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...
Last edited by sunburnt on Fri 23 Apr 2010, 02:37; edited 2 times in total
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 5087 Location: Arizona, U.S.A.
|
Posted: Thu 22 Apr 2010, 23:27 Post subject:
|
|
### 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:
Code: | xwinIDs=`xwininfo -root -children |grep gtkdialog3 |awk '{print $1}' |sed 's/1$/3/'` |
So now can get a complete set of geometry for ALL gtkdialog windows.
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 5087 Location: Arizona, U.S.A.
|
Posted: Fri 23 Apr 2010, 01:17 Post subject:
|
|
Here`s a script to get ALL the data for ALL the gtkdialog GUI`s running:
Code: | #!/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" |
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!
Last edited by sunburnt on Sat 24 Apr 2010, 20:58; edited 2 times in total
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 5087 Location: Arizona, U.S.A.
|
Posted: Sat 24 Apr 2010, 14:17 Post subject:
|
|
Changed it so you run it "sourced" like: ". gtkinfo". So now no file needs to be made.
And then the list of gtkdialog info is in the variable: $gtkINFO
|
Back to top
|
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|