Skip to content

Instantly share code, notes, and snippets.

@kleinron
Created March 11, 2015 10:42
Show Gist options
  • Save kleinron/11d352833478a387bd66 to your computer and use it in GitHub Desktop.
Save kleinron/11d352833478a387bd66 to your computer and use it in GitHub Desktop.
Guake on the right screen
def get_final_window_rect(self):
"""Gets the final size of the main window of guake. The height
is the window_height property, width is window_width and the
horizontal alignment is given by window_alignment.
"""
screen = self.window.get_screen()
height = self.client.get_int(KEY('/general/window_height'))
width = 100
halignment = self.client.get_int(KEY('/general/window_halignment'))
# future we might create a field to select which monitor you
# wanna use
#monitor = 0 # use the left most monitor
monitor = screen.get_n_monitors() - 1 # use the right most monitor
monitor_rect = screen.get_monitor_geometry(monitor)
window_rect = monitor_rect.copy()
window_rect.height = window_rect.height * height / 100
window_rect.width = window_rect.width * width / 100
if width < monitor_rect.width:
if halignment == ALIGN_CENTER:
window_rect.x = monitor_rect.x + (monitor_rect.width - window_rect.width) / 2
elif halignment == ALIGN_LEFT:
window_rect.x = monitor_rect.x
elif halignment == ALIGN_RIGHT:
window_rect.x = monitor_rect.x + monitor_rect.width - window_rect.width
window_rect.y = monitor_rect.y
return window_rect
@kleinron
Copy link
Author

script taken from http://brightbyte.de/page/Guake_on_the_right_screen
but I modified the width to be 100 instead of 80

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment