Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 30 Aug 2014, 18:52
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Get xwininfo to list data of ALL gtkdialog GUIs? [ Solved ]
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
sunburnt


Joined: 08 Jun 2005
Posts: 5016
Location: Arizona, U.S.A.

PostPosted: 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...

Edited_times_total
Back to top
View user's profile Send_private_message 
sunburnt


Joined: 08 Jun 2005
Posts: 5016
Location: Arizona, U.S.A.

PostPosted: 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
View user's profile Send_private_message 
sunburnt


Joined: 08 Jun 2005
Posts: 5016
Location: Arizona, U.S.A.

PostPosted: 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!

Edited_times_total
Back to top
View user's profile Send_private_message 
sunburnt


Joined: 08 Jun 2005
Posts: 5016
Location: Arizona, U.S.A.

PostPosted: 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
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0477s ][ Queries: 12 (0.0040s) ][ GZIP on ]