我想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
。但是我找不到如何配置。
有人知道吗?
我想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
。但是我找不到如何配置。
有人知道吗?
Answers:
我使用两台监视器,并希望将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窗口的起点显示
希望这可以帮助!
sudo
,并且可以在命令开头使用admin权限
https://launchpad.net/~webupd8team/+archive/ubuntu/unstable
看来,他们已经安装了该版本,因此现在您可以在鼠标所在的屏幕上显示的终端之间进行选择,或将其锁定在特定的屏幕上,我认为这是一个足够好的解决方案
解决方案非常简单,因为您要将Guake屏幕与右侧监视器对齐,因此在屏幕的起始位置(x,y),y坐标将相同,即它将从0开始但x坐标将会改变,并且应该等于您左侧显示器的宽度。为了做到这一点,您需要做两件事。
I.如上所述,将监视器号更改为1。排队
window_rect = screen.get_monitor_geometry(0)
用1替换0。
二。在起始坐标的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屏幕对齐方式。
希望这可以帮助 :)
我也提出了一个问题:双显示环境中右侧显示器的guake-Ubuntu 15.10(Wily Werewolf))
在Ubuntu 15.10中,guake进行了一些更改。要将终端更改为正确的监视器,必须进行以下编辑:
sudo vim /usr/lib/python2.7/dist-packages/guake/guake_app.py
然后更改第831行:
window_rect = screen.get_monitor_geometry(monitor)
通过:
window_rect = screen.get_monitor_geometry(1)
杀死并重启guake
有人知道减少这种麻烦的方法吗?
正如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”中,没有在“ window_rect.x” guake中添加“ total_width”,这出现在我的左监视器中间。
PS:对不起,拉利特,但由于我还没有积分=(
wilfo的解决方案对我不起作用。就我而言,我在Linux Mint上使用以下代码解决了问题:
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'))
# 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
我从这里拿走,但我改成80
了100
。
好消息!
在版本0.8.5上,Guake将显示在活动监视器上,因此您无需再调整Guake代码。
apt-get install --only-upgrade guake
我还没有测试过,但是我想您可以编辑/ usr / bin / guake,因为它是python脚本。
找
window_rect = screen.get_monitor_geometry(0)
#line 824在我的机器上
并将0更改为要显示的guake监视器的索引。
0
到1
中/usr/lib/guake/guake.py
。并重新启动guake,但没有任何变化。