Created
October 5, 2012 14:01
-
-
Save guilhem/3839946 to your computer and use it in GitHub Desktop.
Update guake function to manage unity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')) | |
# get the rectangle just from the first/default monitor in the | |
# future we might create a field to select which monitor you | |
# wanna use | |
window_rect = screen.get_monitor_geometry(0) | |
if os.environ.get('DESKTOP_SESSION') == "ubuntu": | |
unity_dock = self.client.get_int(KEY('/apps/compiz-1/plugins/unityshell/screen0/options/icon_size')) | |
if unity_dock < 32: | |
unity_dock = 32 | |
window_rect.width = window_rect.width - ( unity_dock + 17 ) | |
total_width = window_rect.width | |
window_rect.height = window_rect.height * height / 100 | |
window_rect.width = window_rect.width * width / 100 | |
if width < total_width: | |
if halignment == ALIGN_CENTER: | |
window_rect.x = (total_width - window_rect.width) / 2 | |
elif halignment == ALIGN_LEFT: | |
window_rect.x = 0 | |
elif halignment == ALIGN_RIGHT: | |
window_rect.x = total_width - window_rect.width | |
window_rect.y = 0 | |
return window_rect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment