Advertisement
Guest User

Untitled

a guest
Jul 30th, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. def get_final_window_rect(self):
  2. """Gets the final size of the main window of guake. The height
  3. is the window_height property, width is window_width and the
  4. horizontal alignment is given by window_alignment.
  5. """
  6. screen = self.window.get_screen()
  7. height = self.client.get_int(KEY('/general/window_height'))
  8. width = 100
  9. halignment = self.client.get_int(KEY('/general/window_halignment'))
  10.  
  11. # get the rectangle just from the first/default monitor in the
  12. # future we might create a field to select which monitor you
  13. # wanna use
  14. monitor = 1 # use the right most monitor
  15. window_rect = screen.get_monitor_geometry(monitor)
  16. total_width = window_rect.width
  17. window_rect.height = window_rect.height * height / 100
  18. window_rect.width = window_rect.width * width / 100
  19.  
  20. if width < total_width:
  21. if halignment == ALIGN_CENTER:
  22. window_rect.x = (total_width - window_rect.width) / 2
  23. if monitor == 1:
  24. right_window_rect = screen.get_monitor_geometry(0)
  25. window_rect.x += right_window_rect.width
  26. elif halignment == ALIGN_LEFT:
  27. window_rect.x = 0
  28. elif halignment == ALIGN_RIGHT:
  29. window_rect.x = total_width - window_rect.width
  30. window_rect.y = window_rect.y = 0
  31. return window_rect
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement