Xfce Wiki

Sub domains
 

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
windowgrid [2011/04/05 01:00] – created killermoehrewindowgrid [2011/12/13 17:49] killermoehre
Line 7: Line 7:
   * hope for fixing of [[https://bugzilla.xfce.org/show_bug.cgi?id=4178|this]] bug   * hope for fixing of [[https://bugzilla.xfce.org/show_bug.cgi?id=4178|this]] bug
  
-If there are questions, please ask.+If there are questions, please ask (and help).
  
 ---- ----
Line 13: Line 13:
     #!/usr/bin/python2     #!/usr/bin/python2
     # -*- coding: utf-8 -*-     # -*- coding: utf-8 -*-
 +    
     import sys     import sys
     import os     import os
     import wnck     import wnck
     from Xlib import display     from Xlib import display
-    from xfce4 import xfconf +    
     PACKAGE = "window_grid"     PACKAGE = "window_grid"
 +    
     def _help_():     def _help_():
         print(u'Help:')         print(u'Help:')
         print(u'Lorem ipsum dolores…')         print(u'Lorem ipsum dolores…')
         return(0)         return(0)
 +    
     def active_window():     def active_window():
         # returns the default screen, but it fails when not called from X         # returns the default screen, but it fails when not called from X
Line 34: Line 33:
         screen.force_update()         screen.force_update()
         return(screen.get_active_window())         return(screen.get_active_window())
 +    
     def get_resolution(orientation):     def get_resolution(orientation):
         # Accept only 'width' and 'height' for the specific resolution         # Accept only 'width' and 'height' for the specific resolution
         return display.Display.screen(display.Display())[orientation +         return display.Display.screen(display.Display())[orientation +
            '_in_pixels']            '_in_pixels']
 +    
     def get_geometry():     def get_geometry():
         # just a shorting for wnck.Window.get_geometry(active_window())         # just a shorting for wnck.Window.get_geometry(active_window())
         return(active_window().get_geometry())         return(active_window().get_geometry())
 +    
     def window_state(head, sub = int(1)):     def window_state(head, sub = int(1)):
         # The HeadMap showing the screen; 4, 5 and 6 are vertical full,         # The HeadMap showing the screen; 4, 5 and 6 are vertical full,
Line 99: Line 98:
             height = y_res / 2             height = y_res / 2
         return(int(x), int(y), int(width), int(height))         return(int(x), int(y), int(width), int(height))
 +    
     def set_geometry(geo_list):     def set_geometry(geo_list):
         # DOC: http://library.gnome.org/devel/libwnck/stable/WnckWindow.html         # DOC: http://library.gnome.org/devel/libwnck/stable/WnckWindow.html
Line 120: Line 119:
         active_window().set_geometry(10, 15, geo_list[0], geo_list[1], geo_list[2], geo_list[3])         active_window().set_geometry(10, 15, geo_list[0], geo_list[1], geo_list[2], geo_list[3])
         return 0         return 0
-    +        
     def main():     def main():
         if len(sys.argv) > 2:         if len(sys.argv) > 2:
Line 162: Line 161:
         print('%s' % active_window().get_data('submap'))         print('%s' % active_window().get_data('submap'))
         sys.exit(0)         sys.exit(0)
 +    
     if __name__ == '__main__':     if __name__ == '__main__':
         main()         main()