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

Khos kim.hoskin at ...1073...
Fri Jan 25 21:19:11 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


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-tp14931902p15095137.html
Sent from the gambas-user mailing list archive at Nabble.com.





More information about the User mailing list