Hello,

Hopefully it is OK to post queries here relating to use of wnck via
python.  I'm not sure where else to go...

I've written a little python program to tile windows under gnome.  It
worked nicely until I started using compiz.  Under compiz, all windows
report that they are on 'Workspace 1', and so
is_visible_on_workspace(ws) reports that all windows are visible on the
current workspace, even though they are spread across different
workspaces as depicted in the gnome panel's workspace switcher.

It looks to me as though the concept of workspaces no longer holds under
compiz?  i.e. they are all called "Workspace 1" and are number "0"
according to wnck?

I've included a sample program at [1] below with output at [2].  My
versions are shown at [3].

Thanks for any tips,

Jason.

--------------------------------------
[1] Sample program
--------------------------------------

#!/usr/bin/env python

import pygtk
pygtk.require('2.0')
import gtk
import gobject
import wnck
import math

class TestClass:

    def printWindows(self, screen):

      # Print windows on the current workspace
      ws = screen.get_active_workspace()
      windows = screen.get_windows()
      for w in windows:
        type=w.get_window_type()
        if w.is_visible_on_workspace(ws) and type == wnck.WINDOW_NORMAL:
          print "Window: " + repr(w.get_name()) + " " +
repr(w.get_workspace().get_name())

      # Our work is done - quit the main loop
      gtk.main_quit()
    
    def main(self):
      # register a callback to be invoked when main loop is idle
      screen = wnck.screen_get_default()
      gobject.idle_add(self.printWindows, screen)
      gtk.main()

# This is the entry point if we are invoked on the command-line
if __name__ == "__main__":
  testClass = TestClass()
  testClass.main()


--------------------------------------
[2] Program output
--------------------------------------
[...@talby temp]$ ./windows.py 
Window: 'Inbox (2 unread, 44 total) - Evolution' 0
Window: 'screen' 0
Window: 'windows.py (~/temp) - GVIM' 0
Window: 'j...@powell:~' 0
Window: 'wnck.window.is_visible_on_workspace(ws) not working under
compiz' 0
Window: 'WnckWorkspace - Mozilla Firefox 3.5 Beta 4' 0


--------------------------------------
[3] Versions (under fedora 11)
--------------------------------------

[...@talby temp]$ uname -a
Linux talby 2.6.29.4-167.fc11.i686.PAE #1 SMP Wed May 27 17:28:22 EDT
2009 i686 i686 i386 GNU/Linux

[r...@talby ~]# rpm -qa | egrep 'wnck|gtk' | sort
authconfig-gtk-5.4.10-1.fc11.i586
GConf2-gtk-2.26.2-1.fc11.i586
gnome-python2-gtkhtml2-2.25.3-6.fc11.i586
gnome-python2-libwnck-2.26.0-3.fc11.i586
gtk2-2.16.2-1.fc11.i586
gtk2-devel-2.16.2-1.fc11.i586
gtk2-engines-2.18.1-1.fc11.i586
gtk-doc-1.11-4.fc11.noarch
gtkglext-libs-1.2.0-9.fc11.i586
gtkhtml2-2.11.1-5.fc11.i586
gtkhtml3-3.26.1.1-1.fc11.i586
gtkmm24-2.16.0-1.fc11.i586
gtk-nodoka-engine-0.7.2-4.fc11.i586
gtk-sharp2-2.12.7-4.fc11.i586
gtksourceview2-2.6.1-1.fc11.i586
gtkspell-2.0.15-1.fc11.i586
ibus-gtk-1.1.0.20090423-1.fc11.i586
libcanberra-gtk2-0.12-1.fc11.i586
libwnck-2.26.1-1.fc11.i586
PackageKit-gtk-module-0.4.8-2.fc11.i586
pygtk2-2.14.1-1.fc11.i586
pygtk2-libglade-2.14.1-1.fc11.i586
pygtkglext-1.1.0-6.fc11.i586
pygtksourceview-2.4.0-3.fc11.i586
python-slip-gtk-0.1.15-3.fc11.noarch
usermode-gtk-1.100-2.i586
webkitgtk-1.1.4-1.fc11.i586
xdg-user-dirs-gtk-0.8-3.fc11.i586

_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to