Wednesday, October 9, 2013

Guake dual monitor setup


Guake dual monitor setup

Guake is a drop-down terminal, I replace default terminal with guake. It worked properly when I only have one monitor, but it has a bug when use dual monitors. It always pops out on my laptop monitor which is not what I want.

Here I will (1) show you how to install Guake on Fedora/CentOs, (2) How to make Guake display on your external monitor.

(1) How to install Guake?
> sudo yum install guake.

(2) How to make guake available for your external monitor?(Guake version 0.4.4-9.fc18)
> sudo vim /usr/bin/guake

If you are using vim viewing your /usr/bin/guake file, you can search the keyword get_final_window_rect(self): using "/get_final_window_rect(self)and replace the existed method with  the following method:

 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 = 80
        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



Now restart your Guake, It should work!

1 comment: