[pygtk] Sending a message to the window manager (switch to desktop # X)
Pietro Battiston
toobaz at email.it
Wed Feb 10 19:31:55 WST 2010
Il giorno mer, 10/02/2010 alle 11.56 +0100, Osmo Maatta ha scritto:
> Hello,
>
> I have code that sends a message to the window manager to switch to a
> given desktop number.
> I try converted this code from C to GDK on Ubuntu Linux.
>
I posted the following on another mailing list some time ago, it cycles
though desktops. It's in Italian, but I think the mechanisms are clear
enough:
import gtk, gobject, wnck
class Cambiatore(object):
def __init__(self):
self.schermo= wnck.screen_get_default()
def cambia(self):
try:
self.attuale
except:
self.massimo = self.schermo.get_workspace_count()
self.attuale =
self.schermo.get_workspace_index(self.schermo.get_active_workspace())
self.attuale = (self.attuale + 1) % self.massimo
prossimo = self.schermo.get_workspaces()[self.attuale]
prossimo.activate(0)
return True
c = Cambiatore()
gobject.timeout_add_seconds(5, c.cambia)
gtk.main()
# bye
# Pietro
More information about the pygtk
mailing list