In the first post of this series I have covered the upgrade procedure of a Linux PC from Opensuse Leap 15.3 to Leap 15.4. In the second post I tested the system’s behavior for Plasma and Gnome on (X)Wayland. Which was surprisingly good.
The upgrade to Leap 15.4 may come with an inconvenience on systems with multiple attached screens:
You may loose your preferred screen order.
This means that your mouse cursor may not move across your screens as you expect it for your desktop display manager or for your graphical desktop spanned over the number of available screens. And windows moved on the desktop across the right edge of a particular screen may appear on another screen physically positioned to the left of your current screen. Which is not really funny.
Actually, my upgrade to Leap 15.4 confronted me with a wrong screen order for both SDDM and my KDE Plasma desktop sessions. This happened on two of my systems – both equipped with Nvidia graphics cards. Regarding Plasma and Gnome on X11 I have previously often used the nvidia-settings application to fix the screen order and put related statements into the xorg.conf. But on (X)Wayland this is currently not an option. nvidia-settings simply lacks the required functionality there.
Some people recommend in such a case to switch cables between the available plugs at the graphics card. No need to do so. In the present post I show you how to get your screens into the required order again without moving their physical positions or putting their video cables into different plugs.
But I only describe the measures for the display manager SDDM and for KDE Plasma and Gnome on Wayland / X11. For other display managers and desktop environments other tools and steps may have to be applied. Below I use the term (X)Wayland when the methods apply both to a native Wayland session or a Xwayland setup.
Multiple screens and screen order for KDE Plasma on X11 and (X)Wayland
I have 3 screens attached to my PC. I want the desktop to stretch seamlessly across all screens – as if I had a bigger screen on my system. The order by which the screens display parts of your graphical desktop is of course of major importance in such a scenario.
For KDE/Plasma just use its native application to control the desktop: systemsettings. You can use it as a command in a terminal window. In the window opening afterward choose the menu point: “Display and Monitor“. There you find all the required functionality to define the screen order and the scaling and rotation of each of your screens. Here the screenshots for X11 (sorry, I have them only in German):
Using “systemsettings” works both for X11 and (X)Wayland! But on (X)Wayland the information on the screens’ vendors and types is somewhat “reduced”.
However, this does not hamper your ability to define the right screen order and screen positions.
Note: You have to define the settings independently for for X11 and Wayland. This also holds for similar actions on a Gnome desktop; see below.
As mentioned above: For X11 the application “nvidia-settings” offers you an option to fix the screen order, too. And (if you use it as root) you can even save your setup definitions in a file xorg.conf (which has to be placed into /etc/X11/).
Screen order for Gnome on X11 and (X)Wayland
Also on Gnome setting the right screen order via SW is very simple. Just use the gnome “settings” application (in German “Einstellungen”). See here for more information. You get an application window similar to the one shown below:
The functionality there is very similar to what KDE Plasma offers. No need to describe it in detail.
Fixing the screen order for SDDM
For the display manager SDDM we have no graphical tool as for our desktop environments. To achieve a defined screen order for SDDM we have to invoke xrandr via the command line, e.g. in a terminal window. “xrandr” is a very useful Linux command to work with screen modes on an elementary level. I have used xrandr already multiple times in this blog – e.g. for screen settings in virtualized Debian systems.
A xrandr-based recipe to remedy screen order problems for SDDM is explained in a blog of Victor Mendonça. See:
https://blog.victormendonca.com/ 2018/06/29/ how-to-fix-sddm-on-multiple-screens/
Let us look at some of the steps Victor recommends: First, xrandr can show you some details for the screens attached to your Linux system. In my case I got the following information in a Wayland session where I had already fixed the right screen order for the Plasma desktop:
mytux:~ # xrandr | grep connected XWAYLAND0 connected 1920x1200+5120+240 (normal left inverted right x axis y axis) 520mm x 320mm XWAYLAND1 connected primary 2560x1440+2560+0 (normal left inverted right x axis y axis) 550mm x 310mm XWAYLAND2 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 550mm x 310mm mytux:~ #
In a X11 session I got different screen names
mytux:~ # xrandr | grep connected DVI-I-1 connected 1920x1200+5120+240 (normal left inverted right x axis y axis) 518mm x 324mm DP-0 connected primary 2560x1440+2560+0 (normal left inverted right x axis y axis) 553mm x 311mm DP-4 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 553mm x 311mm
Why I got slightly different physical dimensions in Wayland vs. X11 remains a riddle to me. Having measured the physical screen size I must say that the information provided by xrandr on X11 was the correct one. But the pixel resolutions were detected correctly in both cases.
For the next step we have to remember that SDDM can execute a sequence of commands given in form of a script before it starts. The configuration file “/etc/sddm.conf” offers an option to add such a script. In my case the required contents in such a script was:
#!/bin/sh # Xsetup - run as root before the login dialog appears xrandr --output DP-4 --mode 2560x1440 --pos 0x0 --rotate normal --output DP-0 --mode 2560x1440 --pos 2560x0 --rotate normal --output DVI-I-1 --mode 1920x1200 --pos 5120x0 --rotate normal
You can place this script somewhere at a location “YOUR_SCRIP_PATH/Xsetup”, with root rights, only, to read it. The place
as suggested in Victor’s blog is a bit critical as the file may be overwritten by later system upgrades/updates.
Eventually, just add a section [XDisplay] to your file “/etc/sddm.conf”:
[Autologin] Relogin=false User= [General] HaltCommand= RebootCommand= [Theme] [Users] MaximumUid=65000 MinimumUid=1000 [XDisplay] DisplayCommand=YOUR_SCRIP_PATH/Xsetup
YOUR_SCRIP_PATH has, of course, to be replaced by the real path you have chosen for your system.
On Leap 15.4 it is pretty simple to enforce a correct screen order for KDE Plasma and Gnome desktop environments. The graphical applications provided by both systems for “system settings” can be used. For SDDM fixing the screen order requires a bit of manual work with xrandr and sddm.conf.
In the next post of this series I will briefly look at Eclipse with PyDv and Eclipse for PHP8 development on Leap 15.4. Regarding PHP8 we need to take care of the worker settings of Apache2.