Все же предоставленный ответ использования
не работает на три установки монитора, поскольку переход опускает средние экраны и переходит к самому левому или самому правильному экрану.
Другой ответ, рекомендуемый, Помещает расширение Windows, все же его привязка клавиш, кажется, не работает на меня, поскольку это активно, но ярлыки не работают вообще.
Как смочь переместить окна в определенный экран с помощью больше чем двух мониторов с помощью оболочки гнома?
Мой вывод xrandr
:
Screen 0: minimum 8 x 8, current 5760 x 1080, maximum 32767 x 32767
eDP1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 309mm x 174mm
1920x1080 60.0*+ 59.9 48.0
1680x1050 60.0 59.9
1600x1024 60.2
1400x1050 60.0
1600x900 60.0
1280x1024 60.0
1440x900 59.9
1280x960 60.0
1368x768 60.0
1360x768 59.8 60.0
1152x864 60.0
1280x720 60.0
1024x768 60.0
1024x576 60.0
960x540 60.0
800x600 60.3 56.2
864x486 60.0
640x480 59.9
720x405 60.0
640x360 60.0
DP1 disconnected (normal left inverted right x axis y axis)
DP1-1 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 477mm x 268mm
1920x1080 60.0*+
1680x1050 59.9
1600x900 60.0
1280x1024 75.0 60.0
1280x800 59.9
1152x864 75.0
1280x720 60.0
1024x768 75.1 60.0
832x624 74.6
800x600 75.0 60.3
640x480 75.0 60.0
720x400 70.1
DP1-2 connected 1920x1080+3840+0 (normal left inverted right x axis y axis) 477mm x 268mm
1920x1080 60.0*+
1680x1050 59.9
1600x900 60.0
1280x1024 75.0 60.0
1280x800 59.9
1152x864 75.0
1280x720 60.0
1024x768 75.1 60.0
832x624 74.6
800x600 75.0 60.3
640x480 75.0 60.0
720x400 70.1
DP1-3 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
Хорошие новости - то, что y-разрешение всех экранов является тем же, и экраны вертикально выравниваются, таким образом, мы не должны заботиться о возможных y-столкновениях положения, как здесь.
Ниже сценария для предоставления доступа доступным под три (для трех экранов) сочетания клавиш. Путем нажатия клавиш можно переместить окна в любой экран 1, 2 или 3. Сценарий вычисляет, на каком экране окно идет, и расстояние, окно должно быть перемещено.
#!/usr/bin/env python3
import subprocess
import sys
target = int(sys.argv[1])
# --- for Unity, there is a deviation in the y coordinate of the wmctrl -command
# --- for Unity, set: deviation = -28
deviation = 0
# ---
# get the (sorted) x resolution of the screens as a list
screens = [int(s.split("+")[-2]) for s in subprocess.check_output(
["xrandr"]).decode("utf-8").split() if (s).count("+") == 2]
screens.sort()
# get the frontmost window and its coordinates
frontmost = [l.split("#")[-1].strip() for l in subprocess.check_output([
"xprop", "-root"]).decode("utf-8").splitlines() if "_NET_ACTIVE_WINDOW(WINDOW)" in l][0]
active = frontmost[:2]+(10-len(frontmost))*"0"+frontmost[2:]
windata = [l.split() for l in subprocess.check_output(
["wmctrl", "-lG"]).decode("utf-8").splitlines() if active in l][0]
# get the current screen the window is on, and (thus) the x-position (of the screen)
currscreen = len([cr for cr in screens if cr <= int(windata[2])])
currpos = sum([item for item in screens[:currscreen]])
# calculate the target position/the distance to move the window
target_pos = screens[target-1]
move = target_pos-currpos
command = ["wmctrl", "-ir", active, "-e", "0,"+(",").join(
[str(int(windata[2])+move), str(int(windata[3])-28), windata[4], windata[5]])]
# move the window to the targeted screen
subprocess.Popen(command)
Потребности сценария wmctrl
:
sudo apt-get install wmctrl
Скопируйте сценарий в пустой файл, сохраните его как move_window.py
Тестовый прогон сценарий путем выполнения его в окне терминала, с командами:
python3 /path/to/move_window.py 1
Перемещать активное окно в экран 1,
python3 /path/to/move_window.py 2
Перемещать активное окно в экран 2,
python3 /path/to/move_window.py 3
Перемещать активное окно в экран 3
Так как терминал является Вашим активным окном, он должен преодолеть Ваши экраны на командах.
xrandr
, это должно работать также с 2, 3, 4 или любое количество экранов.