View Single Post
Posts: 235 | Thanked: 339 times | Joined on Nov 2010
#10
Originally Posted by helex View Post
Ah, thanks. I haven't known about this. But it seems more as a tool for developers... and after looking at the package I guess it is not a good idea to investigate how this works using python: Package
Sorry, I didn't mean use xprop in the application... I meant use it to figure out the way X properties work etc. and create an implementation in Python. Thankfully, since you're using GTK, the GDK wrapper around X makes this really easy (in Python anyway ); look at this:

Code:
#!/usr/bin/env python
import gtk

screen = gtk.gdk.screen_get_default()
root = screen.get_root_window()
#active_window = screen.get_active_window()
x = root.property_get("_MB_CURRENT_APP_WINDOW")[2]
num = int(''.join(map(str,x))) #http://stackoverflow.com/questions/489999/python-convert-list-of-ints-to-one-number
#print "0x0%lx" % num
active_window = gtk.gdk.window_foreign_new(num)

#if not active_window is None:
wmclass = active_window.property_get("WM_CLASS")[2].split('\x00')[0]
print wmclass
Add error checking as required. Now I can remove Python from my N800

Last edited by jstokes; 2011-04-10 at 08:34.
 

The Following 3 Users Say Thank You to jstokes For This Useful Post: