我想Guake
在右侧显示器使用。
sudo add-apt-repository ppa:cberner/guake
因此我通过, 和添加了这个 ppa sudo apt-get update
。
https://launchpad.net/~cberner/+archive/guake/+index?field.series_filter=raring
说明书上说我可以设置monitor_index
。但我找不到如何配置。
有人知道这件事吗?
答案1
我使用两个显示器,并希望 Guake 显示在右边的显示器上(默认情况下它显示在左边的显示器上)。
我所做的是编辑我的/usr/bin/guake/
文件并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 = 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
基本上,它使用1
监视器索引,然后将正确的屏幕宽度添加到 guake 窗口的起点显示
希望这可以帮助!
答案2
好消息!
在 0.8.5 版本中,Guake 将显示在活动监视器上,因此您不再需要调整 Guake 代码。
答案3
解决方案非常简单,因为您想将 Guake 屏幕与右侧显示器对齐,因此在屏幕的起始位置 (x, y),y 坐标将相同,即它将从 0 开始,但 x 坐标将发生变化,并且它应该等于左侧显示器的宽度。要做到这一点,您需要做两件事。
I. 按照上面的建议将监视器号改为 1。
窗口矩形 = 屏幕.获取监视器几何形状(0)
将 0 替换为 1。
II. 在起始坐标的 x 位置添加第一个屏幕宽度。执行此操作。
代替
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
经过
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
一旦你完成这些更改并重新启动 guake(退出并重新启动),你应该得到所需的 Guake 屏幕对齐。
希望这可以帮助 :)
答案4
正如 lalit 所说,我发现在 ubuntu 14.04LTS 上执行此操作的最佳方法是改变
window_rect = screen.get_monitor_geometry(0)
到
window_rect = screen.get_monitor_geometry(0)
但正在改变
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
到
if width < total_width:
if halignment == ALIGN_CENTER:
window_rect.x += total_width + (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
唯一的区别是在第一个“if”中,没有将“total_width”添加到“window_rect.x”,guake 出现在我的左侧显示器中间。
附言:抱歉,Lalit,但我无法在你的帖子中添加评论,因为我还没有积分=(