Question on Multiple monitors - login screen only on "main" display

Good evening,

Scenario:
I installed OpenSuse 42.3 today, everything fine.
I installed the system with both monitors attached, call them “VGA” and “HDMI” from now on (by default, the installation went on the “HDMI” display).

I’d like to have a specific display setup:

  • the VGA display works as the “main” and everything from the login screen to the desktop goes here by default
  • the HDMI display is switched on only when I want to use it (ex. I start a VirtualBox VM and move it to this HDMI display), or this display is connected to my laptop

Questions:

  1. is this possible?
  2. if possible, I assume some manual configuration/editing is required - what should I do?

Reason for such configuration:

  • the “VGA” display has only a VGA connection and cannot connect it to another system without disconnecting it from the desktop;
  • the HDMI display has multiple input ports, so I can share it with the desktop or my laptop or my Macbook;

My actions until now:

  • Using “Settings -> Configure Desktop -> Display And Monitor” I set up the display position as I want (VGA on the left, HDMI on the right)
  • Plus, I set the VGA as “Primary Display”.

What I get now:

  • on boot, the system shows the same on both screens (POST, OpenSuse boot menu, login screen) [fine with this]
  • the login screen is on both, but the input focus is on the HDMI screen [NOT OK - input should be on the VGA]
  • KDE and taskbar are on the VGA display [OK]
  • desktop content (folders and links) are on both monitors *
  • most of the times application windows open on the HDMI screen [NOT OK - I’d like to have everything on “VGA”]
  • note that the “lock” screen asks for the login credentials on the “main”

OS:

  • Leap 42.3, KDE

HW:

  • Intel i7-7700, 32GB RAM
  • ASUS Prime Z270-K
  • Integrated Intel HD Graphics (multiple outputs: VGA, HDMI, DVI)
  • 2 monitors, one VGA other HDMI

Best Regards.*

What you want essentially involves designating the VGA output as primary, either using --primary in an xrandr startup instance, ‘Option “Primary” “true”’ in xorg.conf*, or a GUI tool that enables equivalent setup. Probably arandr can do it if you don’t run Gnome or KDE and use their equivalents. When I want to run xrandr on startup in openSUSE I create /etc/X11/xinit/xinitrc.d/setup to do the job. Examples of some of my usages of both xorg.conf* and xrandr can be seen in setup and xorg.conf-intel-1920x1080overunder-120 among others at http://fm.no-ip.com/Share/Linux/ .

Thanks a lot for your prompt reply.

My first attempt:

  • installed arandr, did the configuration of VGA (DP-1) as primary, saved the result in my home folder, checked the contents - seems ok:

#!/bin/sh
xrandr --output DP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output HDMI-2 --off --output HDMI-1 --mode 1920x1080 --pos 1920x0 --rotate normal

  • removed the #!/bin/sh from the text
  • copied it to etc/X11/xinit/xinit.d/setup ==> no effect (application windows go to HDMI-1)

On a first try, it seemed to work but only because I forgot to remove the file saved in my home folder under “.screenlayout”.

As far as I understand, up to the login box a default or automatic configuration applies so that:

  • HDMI-1 is “left” at 0,0
  • DP-1 is “right” at 1920,0
    Just after login, my configuration applies:
  • DP-1 is “left” at 0,0
  • HDMI-1 is “right” at 1920,0

Will try again.

Did you restart Xorg (sddm or lightdm or whatever login manager) or reboot rather than just logging out and back in after creating /etc/X11/xinit/xinit.d/setup? Did you make /etc/X11/xinit/xinit.d/setup executable? It may be that whatever setup you tried originally in KDE is undoing what /etc/X11/xinit/xinit.d/setup does and needs to be cleared. Same for arandr. Both make settings personal to the user, while /etc/X11/xinit/xinit.d/setup is a global setting that personal settings can override.

My experience with LEAP 42.3 KDE, nvidia graphics card:

I’ve noticed that different cards (even from the same vendor) prioritize multiple displays differently. For example, a GTX 650 would only show the login screen in one monitor, a GTX 1050 shows on both. Some time ago the default output would be VGA, then it was DVI and now it appears to be HDMI in recent cards.

Here I can have different content in each monitor, as the displays are set to Desktop. I think you have repeat displays if they as ser as Folder View. Right-click desktop>configure display>layout, choose Desktop (translated from pt_BR, so may not be the exact text).

There are some settings in KDE where you can choose where windows will be open - the can remember the last display/position, follow the cursor, etc. Mine is set to remember last position, but both monitors as permanently connected, you’d have to test after disconnecting and reconnecting an external monitor.

Here with a GTX 1050 on LEAP 42.3 the lock screen is shown on both displays and I can type the password in any one. With the GTX 650 on oS 13.2 it only showed in one - the wrong one, of course. This was the HDMI output with a HDMI>DVI cable.*

Note: It’s been a long time since I had to fuss with X config files or xrandr (thank $DEITY). Now it can all be done from the settings menus.

Yes, rebooted the system on every attempt

Yes, setup is executable (I made it r-xr-xr-x just to be sure)

I did some steps more:

  • creating another user: it goes with the “default” (HDMI-1 as primary)
  • setting HMDI1 --off in the xrandr command inside setup: no effect, HDMI1 is on at the login prompt

I assume that there are other system settings overriding setup.

Question: does xrandr generate an activity log? where? this could be a good source of information

I looked around for xorg.conf - found nothing; other configuration items worth checking?

Thanks in advance.

Yep. That’s really annoying even on Windows systems…

Thanks. I found that setting. Now my windows open on the “active” screen - that’s where I clicked with the mouse.

They are optional. You must create it/them if you want or need.

Hm.

Until now, no luck with /etc/X11/xinit/xinitrc.d/setup:

xrandr --output DP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal
xrandr --output HDMI-1 --mode 1920x1080 --pos 1920x0 --rotate normal

I tried it as a shell script too, no effect.

#!/bin/sh
xrandr --output DP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal
xrandr --output HDMI-1 --mode 1920x1080 --pos 1920x0 --rotate normal

This is the content of the folder, setup/setup.sh is rwxr-xr-x so it should be readable and executable by anyone.

AlphaPapa:/etc/X11/xinit/xinitrc.d # ls -l
total 16
-rwxr-xr-x 1 root root 198 Jan 30 16:25 50-systemd-user.sh
-rwxr-xr-x 1 root root 172 May 10 2017 libcanberra-gtk-module.sh
-rwxr-xr-x 1 root root 154 Feb 12 23:29 setup.sh
-rwxr-xr-x 1 root root 40 Mar 18 2017 xdg-user-dirs.sh
AlphaPapa:/etc/X11/xinit/xinitrc.d # vi setup.sh
AlphaPapa:/etc/X11/xinit/xinitrc.d #

What’s puzzling me is that:

  • user settings are more or less OK, when I log in DP-1 is the primary - so the settings I saved when running K Menu ==> Settings ==> Desktop settings are stored (somewhere)
  • system settings are either ignored or immediately overwritten - hard to tell

Reading /var/log/xorg.log.0 I see the “default” settings (HDMI-1 left at 0,0, DP-1 right)

35.203] (II) modeset(0): Output HDMI-1 connected
35.203] (II) modeset(0): Output HDMI-2 disconnected
35.203] (II) modeset(0): Output DP-1 connected
35.203] (II) modeset(0): Using spanning desktop for initial modes
35.203] (II) modeset(0): Output HDMI-1 using initial mode 1920x1080 +0+0
35.203] (II) modeset(0): Output DP-1 using initial mode 1920x1080 +1920+0
35.203] (II) modeset(0): Using default gamma of (1.0, 1.0, 1.0) unless otherwise stated.
35.203] (==) modeset(0): DPI set to (96, 96)

Everything in /etc/X11/ is global. Global settings can be overridden by settings in $HOME. For global settings to have effect, conflicting settings in $HOME must not exist. To test /etc/X11/ settings you need to either login to a user session that is virgin as to those settings, or clear those settings set by the DE for your existing user, in your case, most likely those of Plasma’s in ~/.config/ (which are all mixed up with other settings instead of segregated, as if as should have been but is not ~/.config/kde5/ or ~/.config/plasma/). Whether the settings Plasma made are personal to your user session or personal to Plasma I do not know, as I do not know where they are made. You might try an IceWM session to see whether they stick to the user or only to Plasma. Simplest global settings test would be a session for some other user with no saved settings.

First, thanks all for you advice.

I finally got the result I wanted - I’m not sure why this works…

  1. I created /etc/X11/xinit/xinitrc.d/setup as suggested, plus chmod 755 to make it executable

xrandr --output DP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal
xrandr --output HDMI-1 --mode 1920x1080 --pos 1920x0 --rotate normal

  1. I then added a call to “setup” as the first thing in /etc/X11/xdm/Xsetup:

#!/bin/sh

Xsetup: Setup an xlogin’s display

Copyright (c) 1998-2003 SuSE GmbH Nuernberg, Germany.

please report bugfixes or comments at http://www.suse.de/feedback.

Author: Werner Fink, <http://www.suse.de/feedback>

. /etc/X11/xinit/xinitrc.d/setup
LIBDIR=/usr/lib/X11
ETCDIR=/etc/X11
XDMDIR=${ETCDIR}/xdm
BINDIR=/usr/bin

no_exit_on_failed_exec=1
type shopt >/dev/null 2>&1 && shopt -s execfail
set +e >/dev/null 2>&1

. /etc/sysconfig/displaymanager

Check for cpp

cpp=-nocpp
type cpp >/dev/null 2>&1 && cpp=

Restarted.

Voila’: the “DP1” (VGA) screen shows the login box and has focus; everything goes here - so the other screen (HDMI-1) can be off when I do not need it; if HDMI-1 is on it simply extends the desktop (I use it for a running Virtualbox VM), but DP-1 is still “main”.