在家里和工作中享受多监视器设置,但不知道如何在没有鼠标的情况下在单个监视器(即“屏幕”)之间移动焦点?
键盘快捷方式是切换虚拟桌面的好方法,我在ccsm中查看了各种选项,但没有想到什么。
我还查看了其他问题,如不同X屏之间的焦点切换或指向双屏口服液和开关柜的链接,但所有这些问题似乎都与每个xorg.conf的单独屏幕有关。这些天,统一“只是工作”与多显示器(通过显示端口),所以这是一个尴尬的财富。
但是,任何关于如何在单个(虚拟)统一显示中导航多个(物理)屏幕的提示都是非常受欢迎的。
发布于 2015-07-25 15:23:38
上
下面的脚本将切换(和“焦点”)之间的左屏幕和右屏幕,如果两个屏幕或多或少的中心-或顶部对齐,或多或少的垂直分辨率。
我假设在几乎所有的左右屏幕设置的情况下,它都能工作。
#!/usr/bin/env python3
import subprocess
# just a helper function
get = lambda cmd: subprocess.check_output(cmd).decode("utf-8")
# get the current mouse position
current = [int(n) for n in [it.split(":")[1] for it in get(["xdotool", "getmouselocation"]).split()[:2]]]
# get the x/y size of the left screen
screendata = [(s.split("x")[0], s.split("x")[1].split("+")[0]) for s in get(["xrandr"]).split() if "+0+0" in s ][0]
xy = [int(n) for n in screendata]
# see if the mouse is on the left- or right screen
if current[0] < xy[0]:
# if the mouse currently is on the left screen, move it to the right (from the middle of the left screen)
command = ["xdotool", "mousemove", "--sync", str(current[0]+xy[0]), str(xy[1]/2)]
else:
# if the mouse currently is on the left screen, move it to the right (from the middle of the left screen)
command = ["xdotool", "mousemove", "--sync", str(current[0]-xy[0]), str(xy[1]/2)]
subprocess.Popen(command)
# optional: click after the mouse move: comment out if not needed / wanted
subprocess.Popen(["xdotool", "click", "1"])xdotool (!)sudo apt-get install xdotooltoggle_screenloc.py如果脚本正在运行,则它:
xrandr command.的输出导出(左)屏幕的大小(x/y)xdotool)命令:来查看鼠标在左右屏幕上的情况。如果鼠标指针位于左侧屏幕上:
如果鼠标指针位于右侧屏幕上:
随后,鼠标单击一次,在(可能的)全屏应用程序上设置焦点(可选)。
发布于 2019-04-01 17:35:04
这个存储库可能会帮助您
https://github.com/Eitol/screen_焦点_变送器
将focus_changer.py左脚本放置在固定位置(例如/ opt ),然后在设置中添加键绑定/快捷方式/热键
python3 /opt/ Focus _changer.py左转左
python3 /opt/ Focus _changer.py右转右
https://askubuntu.com/questions/652621
复制相似问题