2014年7月30日 星期三

Guake Terminal多螢幕時在最右邊顯示

當使用多螢幕時候Guake Terminal預設會在最左邊螢幕出現
如果要讓其顯示於最右邊可以透過修改
/usr/lib/guake/guake.py 的 get_final_window_rect

原文連結
  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 #設定Guake寬度為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
       #設定Guake顯示位置
        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

沒有留言:

張貼留言

搜尋此網誌