desktop1.py 774 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/python
  2. from gi.repository import Gtk
  3. def transparent_expose(widget, event):
  4. cr = widget.window.cairo_create()
  5. cr.set_operator(cairo.OPERATOR_CLEAR)
  6. region = gtk.gdk.region_rectangle(event.area)
  7. cr.region(region)
  8. cr.fill()
  9. return False
  10. class DesktopWindow(gtk.Window):
  11. # Based upon the composited window example from:
  12. # http://www.pygtk.org/docs/pygtk/class-gdkwindow.html
  13. def __init__(self, *args):
  14. gtk.Window.__init__(self, *args)
  15. self.set_skip_taskbar_hint(True)
  16. self.set_skip_pager_hint(True)
  17. self.set_keep_below(True)
  18. self.set_decorated(False)
  19. self.stick()
  20. screen = self.get_screen()
  21. rgba = screen.get_rgba_colormap()
  22. self.set_colormap(rgba)
  23. self.set_app_paintable(True)
  24. self.connect("expose-event", transparent_expose)