[Gambas-user] New to Gambas - coding question how to find the active window on an Ubuntu 7.10 de

Khos kim.hoskin at ...1073...
Fri Jan 25 21:19:59 CET 2008


Hi there,

In the meantime I have found a command that might just do what I need:
sleep 5; xprop -id `xprop -root |nawk '/_NET_ACTIVE_WINDOW/ {print $5;
exit;}'` |nawk -F = '/WM_CLASS/ {N=split($2, A, ", "); gsub(/\"/,"",A[2]);
print A[2]; exit;}'

I can use this with the shell command.. and I will need to change WM_CLASS
to WM_ICON_NAME and  change the splitting of the result.. what do you think?
can you maybe try see if you can change this command a bit..looks so
complicated. in the terminal it works but in gambas it does not show the
result in a textbox..why is that?

Thank you so much!
Kim


Jaap Cramer wrote:
> 
> 
> Hi Kim
> 
> If you want to use xwininfo (and any other program for that matter), you
> can with gambas. use SHELL
> 
> DIM s AS String
> SHELL "xwininfo" TO s
> message(s)
> 
> These three lines store the consloe output to variable s. I chose to
> output S in a message. You can ofcoarse change that, and get your needed
> information out of s by the usual stringcommands
> 
> goodluck!
> 
> Jaap
> 
> 
> ----------------------------------------
>> Date: Thu, 24 Jan 2008 11:42:11 -0800
>> From: kim.hoskin at ...1073...
>> To: gambas-user at lists.sourceforge.net
>> Subject: Re: [Gambas-user] New to Gambas - coding question how to find
>> the active window on an Ubuntu 7.10 desktop
>> 
>> 
>> Thanks Benoit,
>> 
>> Pity you won't do it now :) , how can I persuade you to do it faster? I
>> have
>> an idea but cannot seem to do it with gambas. any ideas how I can use
>> xwininfo in gambas and extract or collect the information that this
>> xwinutil
>> util displays? does the util write info to a text file maybe to the
>> clipboard? there must be a way of getting the  active window info from X
>> or
>> xwininfo through gambas currently.. can you think of a low-level X11
>> libraries call/command that I can use with Shell in Gambas to do what I
>> want? if so I would really be thankful :)
>> 
>> or how could I install the wmctrl util Stefano was advising of and
>> package
>> it together with my application so when people install it installs both
>> programs? is that possible?
>> 
>> Thanks
>> Kim
>> 
>> 
>> Benoit Minisini wrote:
>>> 
>>> On mercredi 23 janvier 2008, Khos wrote:
>>>> Hi again,
>>>> I am still struggling to do this, I have started searching for
>>>> shell/terminal commands I could try use because  e.g. using shell
>>>> xwininfo
>>>> will allow me to hover the mouse over a window, then I click and it
>>>> will
>>>> give some info of that window I clicked on...but how can I do this
>>>> without
>>>> having to click on the window? I just want to be able to hover over any
>>>> window and it should give me the windows info (size, is it he active
>>>> win
>>>> etc etc). Any ideas? desktop,find won't so this I think.. could you lok
>>>> into this for me and provide some guidance?
>>>>
>>>> Thanks
>>>> Kim
>>>>
>>> 
>>> This is not possible directly in Gambas. Having information on top-level 
>>> windows is done with low-level X11 libraries call and with the NET
>>> protocol 
>>> as specified on freedesktop.org web site.
>>> 
>>> xwininfo will gives you all X11 information about a specified window,
>>> but
>>> you 
>>> won't get the information of the NET protocol.
>>> 
>>> I plan to implement the NET protocol in a component by using the
>>> corresponding 
>>> class of the KDE libraries. This component will depend on QT, and will
>>> allow 
>>> you to get a lot of information from the window manager. But I won't do
>>> it 
>>> now!
>>> 
>>> Regards,
>>> 
>>> -- 
>>> Benoit Minisini
>>> 
>>> -------------------------------------------------------------------------
>>> This SF.net email is sponsored by: Microsoft
>>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>> _______________________________________________
>>> Gambas-user mailing list
>>> Gambas-user at lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/New-to-Gambas---coding-question-how-to-find-the-active-window-on-an-Ubuntu-7.10-desktop-tp14931902p15072518.html
>> Sent from the gambas-user mailing list archive at Nabble.com.
>> 
>> 
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 
> _________________________________________________________________
> Nieuw: Windows Live Messenger 2008! Gratis downloaden
> http://get.live.com/messenger
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 
> 

-- 
View this message in context: http://www.nabble.com/New-to-Gambas---coding-question-how-to-find-the-active-window-on-an-Ubuntu-7.10-desktop-tp14931902p15095138.html
Sent from the gambas-user mailing list archive at Nabble.com.





More information about the User mailing list