File: wnck_example.py

package info (click to toggle)
gnome-python-desktop 2.32.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,548 kB
  • sloc: sh: 10,214; xml: 8,851; ansic: 3,428; python: 1,457; makefile: 664
file content (22 lines) | stat: -rw-r--r-- 842 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gtk
import wnck

def main():
    screen = wnck.screen_get_default()
    # Process pending gtk+ events so that wnck can find out about existing windows.
    while gtk.events_pending():
        gtk.main_iteration()
    for window in screen.get_windows():
        # A XID is a number that identifies a X window.
        xid = window.get_xid()
        # By calling gtk.gdk.window_foreign_new(xid), we are creating
        # a gtk.gdk.Window which wraps the window that is identified by
        # the XID. It will return None if it can't find the X window
        # identified by the XID in question.
        wrapped_window = gtk.gdk.window_foreign_new(xid)
        # We are maximizing the window here, but
        # you can do almost anything with a gtk.gdk.Window.
        wrapped_window.maximize()

if __name__ == '__main__':
    main()