双显示器设置上的全屏应用程序

Xor*_*lse 9 arch-linux xorg xrandr nvidia optimus

Linux 上的 Optimus 远非完美,但是使用本机nVidia驱动程序我过去遇到的大多数问题都主要解决了,除了一个。

每当我运行全屏应用程序时,例如Kodi或某些Steam游戏,位置关闭时,屏幕在 1080p 上正好位于 2 个屏幕的中间,或者在任何显示器上仅显示左半部分。

我认为这是由于我如何使用xrandr. 当sddm初始化运行下面的命令:

xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --output HDMI-1-1 --mode 1920x1080 --pos 1920x0 --output HDMI-0 --primary --mode 1920x1080 --panning 3840x1080+0+0/0x0+0+0/0/0/-1920/0
Run Code Online (Sandbox Code Playgroud)

但是它可以完美运行,因为您可能会注意到容器是 3x1080p,因为这是因为有 3 个屏幕(全部为 1080p),禁用了我的内部显示并使用平移,我能够将 2 个显示器的输出移动到彼此相邻的位置。

看来我无法控制全屏行为,无法控制KDE或使用put. 在应用程序设置中播放我可以选择在哪个显示器上渲染它,但它无论如何都在中心渲染。

澄清:

xs on monitor left at 1920/2
ys on monitor left at 1080
xe on monitor right at (1920/2)+1920
ye on monitor right at 1080
Run Code Online (Sandbox Code Playgroud)

这是视觉参考的链接

老实说,我已经尝试了很多东西,但在这里我不知所措。我不是 Linux 专家,我已经使用它作为我唯一的操作系统大约 4 年了。

由于 KDE 支持,Wayland我愿意尝试一下,但是由于我过去在使用 Optimus 时遇到了很多问题,我不愿意尝试它,因为一切都运行得很顺利,而且关于 Optimus / Nvidia / Wayland 兼容性的信息很少.

在为新的稳定显示管理器做任何激进的事情之前,我可能错过了什么吗?或者也许是来自终端的一个简单命令,用于运行我完全错过的应用程序。

任何帮助表示赞赏。

附加信息:

xorg.conf, xorg.conf.d 为空。

Section "Module"
    Load "modesetting"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1:0:0"
    Option "AllowEmptyInitialConfiguration"
EndSection
Run Code Online (Sandbox Code Playgroud)

如果需要,请在评论中索取更多信息。

l0b*_*0b0 1

多年来,我一直在使用一些脚本xrandrArch Linux 上设置并排和(当前)T 形桌面。让side-byside.sh适应您的需求应该是一个简单的工作:

#!/bin/sh
eval `\`dirname -- "$0"\`/monitor_resolutions.sh`
expected_monitors=2
if [ "${monitor_count:-0}" -ne "$expected_monitors" ]
then
    echo "$0: Expected ${expected_monitors} monitors; found ${monitor_count:-0}." >&2
    exit 1
fi

xrandr \
    --output "$monitor1_name" \
        --mode ${monitor1_width}x${monitor1_height} \
        --rotate normal \
    --output "$monitor2_name" \
        --mode ${monitor2_width}x${monitor2_height} \
        --right-of "$monitor1_name" \
        --rotate normal
Run Code Online (Sandbox Code Playgroud)

Monitor_Resolutions.sh帮助程序脚本:

#!/bin/sh
#
# NAME
#        monitor_resolutions.sh - Variables for monitor resolutions
#
# SYNOPSIS
#        eval `./monitor_resolutions.sh`
#
# DESCRIPTION
#        Prints a set of `eval`-able variable assignments with monitor name,
#        width and height for each monitor plus a monitor count.
#
# EXAMPLES
#        eval `./monitor_resolutions.sh`
#               Assign monitor1_name, monitor1_width, monitor1_height,
#               monitor2_name, etc. and monitor_count variables.
#
# BUGS
#        https://github.com/l0b0/tilde/issues
#
# COPYRIGHT
#        Copyright (C) 2013-2014 Victor Engmark
#
#        This program is free software: you can redistribute it and/or modify
#        it under the terms of the GNU General Public License as published by
#        the Free Software Foundation, either version 3 of the License, or
#        (at your option) any later version.
#
#        This program is distributed in the hope that it will be useful,
#        but WITHOUT ANY WARRANTY; without even the implied warranty of
#        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#        GNU General Public License for more details.
#
#        You should have received a copy of the GNU General Public License
#        along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
################################################################################

monitor_info() {
    xrandr --query | tee ~/.xsession-xrandr-query
}

monitor_resolutions() {
    # Input: XRandR monitor info
    # Output: Lines with monitor name, width and height separated by spaces
    while read -r word1 word2 _
    do
        if [ "${word2:-}" = 'connected' ]
        then
            IFS='xi ' read -r width height _
            printf '%s %d %d\n' "$word1" "$width" "$height"
        fi
    done
}

monitor_assignments() {
    # Input: Lines with monitor name, width and height separated by spaces
    # Output: eval-able variable assignments for each input value, including a final count
    count=0
    while read monitor width height
    do
        count=$(($count + 1))
        printf "monitor%d_name='%s'\n" "$count" "$monitor"
        printf "monitor%d_width='%s'\n" "$count" "$width"
        printf "monitor%d_height='%s'\n" "$count" "$height"
    done
    printf "monitor_count='%s'\n" "$count"
}

monitor_info | monitor_resolutions | monitor_assignments
Run Code Online (Sandbox Code Playgroud)

side-by-side.sh启动 X 后,在本地或其他地方运行.xprofile,应该就可以开始了。

此设置适用于 AMD 和 nVidia 显卡,使用专有和开源驱动程序。我不认为我曾经尝试过使用 Wayland 而不是 X,但我怀疑如果xrandr与 Wayland 一起工作的话应该可以工作。