How to use guake at right side monitor in dual display environment

Solution 1:

I use two monitors and wanted Guake to be displayed on the right one (where by default it is displayed on the left one).

What I did was to edit my /usr/bin/guake/ file replacing the get_final_window_rect method with this:

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
    monitor = 1 # use the right most monitor
    window_rect = screen.get_monitor_geometry(monitor)
    # see if we don't have another screen, and if so, use the first one
    if window_rect.width == 0:
        monitor = 0
        window_rect = screen.get_monitor_geometry(monitor)
    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
            if monitor == 1:
                    right_window_rect = screen.get_monitor_geometry(0)
                    window_rect.x += right_window_rect.width
        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

Basically, it uses 1 as the monitor index and later on, adds the right screen width to the start point display of the guake window

hope this helps!

Solution 2:

Good news!

On version 0.8.5, Guake will be displayed on the active monitor, so you don't have to tweak the Guake code anymore.

Solution 3:

The solution is very simple, as you want to align your Guake screen to your right hand side monitor so in starting position (x, y) of screen, y co-ordinate is going to be same i.e. it will start from 0 but x coordinate will change and it should be equal to width of you left side monitor. To be able to do this you need to do 2 things.

I. Change monitor number to 1, as suggested above. In line

window_rect = screen.get_monitor_geometry(0)

Replace 0 by 1.

II. Add first screen width in x position of starting co-ordinate. to do this.

Replace

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

By

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

Once you do these changes and restart guake (Quit and start again), You should get the desired alignment of Guake screen.

Hope this helps :)

Solution 4:

I also made this a question: guake at right side monitor in dual display environment - Ubuntu 15.10(Wily Werewolf))

In Ubuntu 15.10 guake has changed a little bit. To change your terminal to the right monitor you have to edit:

sudo vim /usr/lib/python2.7/dist-packages/guake/guake_app.py

then change in line 831:

window_rect = screen.get_monitor_geometry(monitor)

by:

window_rect = screen.get_monitor_geometry(1)

kill and restart guake

Anyone knows a way to do this less hacky?