External monitors: trouble with restoring desired configurations

Hello everyone,

after being for a long time with MacOS, I am returning to Linux. Having tried out Manjaro I am impressed and overall very happy. It’s awesome!

However, I am struggling with xwindows. Even though I have been pretty good at configuring it 15-20 years ago (remembering times where you had to create modelines manually and all), I need to accept the fact that meanwhile too much has changed, and also I have forgotten most of what I knew.

Here is one thing with configuration of external monitor layout, which I do not get my head around. I don’t know, how to achieve what I am looking for or if that is possible at all.

Here is my scenario:
Laptop (Lenovo P52 i7, NVIDIA GP107GLM [Quadro P2000 Mobile] using non-free nvidia drivers v525).
I’ve got two different locations, where I am connecting my laptop (Lenovo P52) to external monitors, one being at the office and the other being at home.

Office: here I do have three external monitors, which are being used in addition to the internal display ( 4 in total). Desired layout: desktop expands across monitors being arranged in a horizontal row (classic multi head setup). There is a Lenovo docking station (actually more of an expander) with 2 HDMI and 2DP and that’s where the monitors are connected.

Home: here I do have one monitor (Dell), which is permanently connected (internal miniDP) and a second monitor (Samsung, via internal HDMI, attached to HDMI console switch), which will be part of the setup only temporarily (there is a second machine next to the laptop and a HDMI console/monitor switch attached to the Samsung display, that’s how it is only part time connected to the laptop)
The console switch is a ATEN CS22H.

Whenever I change my setup (from office to home /at home adding or removing the Samsung / from home to office) I need to go through the “configure display settings…” setup, sometimes also need to do funny things. In the end, it is always possible to achieve the desired exact setup (monitor resolution, arrangement etc). It only takes too long and I need to reconfigure every time there is a change.

Two things I am missing:
(1) jump to concrete, static layout at office
For some reason, xwindows/kde/linux (sorry, I can’t tell the exact responsibilities apart) can’t seem to detect the environment(monitor constellation) and/or remember the settings for a specific environment constellation. Often in the office, I need to tweak with the setup in order to make it work. Even though I have an idea what I am trying to achieve, I could not find a deterministic way how to get there. At times some external monitor is disabled and I need to set it to “enabled” again, sometimes I need to adjust resolution, but almost all the time I need to reassign the monitor positions.
Sometimes, though, it is even not possible to enable the external monitors. What I found: it then helps to play with the kscreen monitor selection control (UI overlay, triggered via laptop functional key for monitor arrangements), but I am failing to find a deterministic way. Sometimes the internal screen is black, showing nothing but the cursor, while the external ones are turned off. In these situations the kscreen OSD won’t show up at all. So most of the time an I am forced to blindly switch settings there, until randomly ending up with a suitable configuration. And eventually I find the config and then everything is great and perfect (and the modern KDE is so awesome!)
Unfortunately, in extreme cases this can take up to 5-10 minutes and am starting to question more and more if I really can afford this game every day. Especially, since every other day there will be meetings in a different room where I take the laptop with me, just to start the game again after having returned to my desk.

(2) second issue at home:
My preferred setup here was being able to seamlessly switch back and forth on the console/monitor switch, while the Linux machine simply adds and removes that Samsung monitor. I am happy to accept a longer time where the monitors need to settle, if there is a way where I am not forced to go through the whole “configure displays…” procedure every time I switch that console switch.

What options do I have to approach the issue? Astoishingly, ubuntu was able to cope with different environments - I have no idea why. I am open to suggestions of any kind, as long as it does not involve going back to ubuntu.

I apologize this text has gotten a bit longer, I just couldn’t find a more concise way of describing my particular issue.

Thank you so much!

Here is the output of my inxi -v7azy:

System:
  Kernel: 6.1.12-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 12.2.1
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.1-x86_64
    root=UUID=25a01824-5fa0-4308-9fb7-5c64ba8af857 rw quiet
    cryptdevice=UUID=e9c77175-3ed3-4a78-b8d1-bdd428509644:luks-e9c77175-3ed3-4a78-b8d1-bdd428509644
    root=/dev/mapper/luks-e9c77175-3ed3-4a78-b8d1-bdd428509644 splash
    udev.log_priority=3
  Desktop: KDE Plasma v: 5.26.5 tk: Qt v: 5.15.8 wm: kwin_x11 vt: 1 dm: SDDM
    Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Laptop System: LENOVO product: 20MAS1FD00 v: ThinkPad P52
    serial: <superuser required> Chassis: type: 10 serial: <superuser required>
  Mobo: LENOVO model: 20MAS1FD00 serial: <superuser required> UEFI: LENOVO
    v: N2CET64W (1.47 ) date: 06/10/2022
Battery:
  ID-1: BAT0 charge: 72.4 Wh (99.9%) condition: 72.5/90.1 Wh (80.5%)
    volts: 12.8 min: 11.4 model: LGC 01AV495 type: Li-poly serial: <filter>
    status: not charging cycles: 134
  Device-1: hidpp_battery_1 model: Logitech M705 serial: <filter> charge: 60%
    rechargeable: yes status: discharging
Memory:
  RAM: total: 15.32 GiB used: 6.46 GiB (42.2%)
  RAM Report: permissions: Unable to run dmidecode. Root privileges required.
CPU:
  Info: model: Intel Core i7-8850H bits: 64 type: MT MCP arch: Coffee Lake
    gen: core 8 level: v3 note: check built: 2018 process: Intel 14nm family: 6
    model-id: 0x9E (158) stepping: 0xA (10) microcode: 0xF0
  Topology: cpus: 1x cores: 6 tpc: 2 threads: 12 smt: enabled cache:
    L1: 384 KiB desc: d-6x32 KiB; i-6x32 KiB L2: 1.5 MiB desc: 6x256 KiB
    L3: 9 MiB desc: 1x9 MiB
  Speed (MHz): avg: 1099 high: 2600 min/max: 800/4300 scaling:
    driver: intel_pstate governor: powersave cores: 1: 800 2: 2600 3: 800 4: 800
    5: 2600 6: 800 7: 799 8: 800 9: 800 10: 800 11: 800 12: 800 bogomips: 62431
  Flags: 3dnowprefetch abm acpi adx aes aperfmperf apic arat
    arch_capabilities arch_perfmon art avx avx2 bmi1 bmi2 bts clflush
    clflushopt cmov constant_tsc cpuid cpuid_fault cx16 cx8 de ds_cpl dtes64
    dtherm dts epb ept ept_ad erms est f16c flexpriority flush_l1d fma fpu
    fsgsbase fxsr ht hwp hwp_act_window hwp_epp hwp_notify ibpb ibrs ida
    intel_pt invpcid invpcid_single lahf_lm lm mca mce md_clear mmx monitor
    movbe mpx msr mtrr nonstop_tsc nopl nx pae pat pbe pcid pclmulqdq pdcm
    pdpe1gb pebs pge pln pni popcnt pse pse36 pti pts rdrand rdseed rdtscp
    rep_good sdbg sep sgx sgx_lc smap smep smx ss ssbd sse sse2 sse4_1 sse4_2
    ssse3 stibp syscall tm tm2 tpr_shadow tsc tsc_adjust tsc_deadline_timer
    vme vmx vnmi vpid x2apic xgetbv1 xsave xsavec xsaveopt xsaves xtopology
    xtpr
  Vulnerabilities:
   (vulnerabilities information considered as irrelevant, please let me know in case that is of interest)
Graphics:
  Device-1: NVIDIA GP107GLM [Quadro P2000 Mobile] vendor: Lenovo driver: nvidia
    v: 525.89.02 alternate: nouveau,nvidia_drm non-free: 525.xx+
    status: current (as of 2023-02) arch: Pascal code: GP10x process: TSMC 16nm
    built: 2016-21 pcie: gen: 3 speed: 8 GT/s lanes: 16 bus-ID: 01:00.0
    chip-ID: 10de:1cba class-ID: 0300
  Device-2: Chicony Integrated Camera (1280x720@30) type: USB
    driver: uvcvideo bus-ID: 1-8:3 chip-ID: 04f2:b604 class-ID: 0e02
    serial: <filter>
  Display: x11 server: X.Org v: 21.1.7 compositor: kwin_x11 driver: X:
    loaded: nvidia gpu: nvidia display-ID: :0 screens: 1
  Screen-1: 0 s-res: 5760x1600 s-dpi: 144 s-size: 1016x282mm (40.00x11.10")
    s-diag: 1054mm (41.51")
  Monitor-1: DP-2 pos: primary,bottom-l res: 1920x1080 hz: 60 dpi: 142
    size: 344x193mm (13.54x7.6") diag: 394mm (15.53") modes: N/A
  Monitor-2: DP-3 pos: top-right res: 3840x1600 hz: 60 dpi: 111
    size: 880x367mm (34.65x14.45") diag: 953mm (37.54") modes: N/A
  Monitor-3: HDMI-0 size-res: N/A modes: N/A
  API: OpenGL v: 4.6.0 NVIDIA 525.89.02 renderer: Quadro P2000/PCIe/SSE2
    direct-render: Yes
Audio:
  Device-1: Intel Cannon Lake PCH cAVS vendor: Lenovo driver: snd_hda_intel
    v: kernel bus-ID: 1-1.1:9 chip-ID: 0b0e:24c8
    alternate: snd_soc_skl,snd_sof_pci_intel_cnl bus-ID: 00:1f.3 class-ID: 0300
    chip-ID: 8086:a348 serial: <filter> class-ID: 0403
  Device-2: NVIDIA GP107GL High Definition Audio driver: snd_hda_intel
    v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16 bus-ID: 01:00.1
    chip-ID: 10de:0fb9 class-ID: 0403
  Device-3: GN Netcom Jabra Link 380 type: USB
    driver: jabra,snd-usb-audio,usbhid
  Sound API: ALSA v: k6.1.12-1-MANJARO running: yes
  Sound Server-1: JACK v: 1.9.22 running: no
  Sound Server-2: PulseAudio v: 16.1 running: yes
  Sound Server-3: PipeWire v: 0.3.65 running: yes
Network:
  Device-1: Intel Cannon Lake PCH CNVi WiFi driver: iwlwifi v: kernel
    bus-ID: 00:14.3 chip-ID: 8086:a370 class-ID: 0280
  IF: wlp0s20f3 state: up mac: <filter>
  IP v4: <filter> type: dynamic noprefixroute scope: global
    broadcast: <filter>
  IP v6: <filter> type: dynamic noprefixroute scope: global
  IP v6: <filter> type: dynamic noprefixroute scope: global
  IP v6: <filter> type: noprefixroute scope: link
  Device-2: Intel Ethernet I219-LM vendor: Lenovo driver: e1000e v: kernel
    port: N/A bus-ID: 00:1f.6 chip-ID: 8086:15bb class-ID: 0200
  IF: enp0s31f6 state: down mac: <filter>
  IF-ID-1: br-0e37865a5aab state: down mac: <filter>
  IP v4: <filter> scope: global broadcast: <filter>
  IF-ID-2: docker0 state: down mac: <filter>
  Message: Output throttled. IPs: 1; Limit: 10; Override: --limit [1-x;-1
    all]
  WAN IP: <filter>
Bluetooth:
  Device-1: Intel Bluetooth 9460/9560 Jefferson Peak (JfP) type: USB
    driver: btusb v: 0.8 bus-ID: 1-14:7 chip-ID: 8087:0aaa class-ID: e001
  Report: rfkill ID: hci0 rfk-id: 1 state: up address: see --recommends
Logical:
  Message: No logical block device data found.
  Device-1: luks-OBFUSCATED maj-min: 254:0
    type: LUKS dm: dm-0 size: 476.64 GiB
  Components:
  p-1: nvme0n1p2 maj-min: 259:2 size: 476.64 GiB
RAID:
  Message: No RAID data found.
Drives:
  Local Storage: total: 476.94 GiB used: 290.41 GiB (60.9%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Intel model: SSDPEKKF512G8L
    size: 476.94 GiB block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s
    lanes: 4 type: SSD serial: <filter> rev: L08P temp: 34.9 C scheme: GPT
  Message: No optical or floppy data found.
Partition:
  ID-1: / raw-size: 476.64 GiB size: 468.09 GiB (98.21%)
    used: 290.41 GiB (62.0%) fs: ext4 dev: /dev/dm-0 maj-min: 254:0
    mapped: luks-OBFUSCATED label: N/A
    uuid: OBFUSCATED
  ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
    used: 472 KiB (0.2%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1 label: N/A
    uuid: 11CF-22C6
Swap:
  Kernel: swappiness: 60 (default) cache-pressure: 100 (default)
  ID-1: swap-1 type: file size: 20 GiB used: 0 KiB (0.0%) priority: -2
    file: /swapfile
Unmounted:
  Message: No unmounted partitions found.
USB:
  Hub-1: 1-0:1 info: Hi-speed hub with single TT ports: 16 rev: 2.0
    speed: 480 Mb/s chip-ID: 1d6b:0002 class-ID: 0900
  Hub-2: 1-1:8 info: Cambridge Silicon Radio ports: 4 rev: 2.0 speed: 12 Mb/s
    power: 100mA chip-ID: 0a12:4010 class-ID: 0900
  Device-1: 1-1.1:9 info: GN Netcom Jabra Link 380 type: Audio,HID
    driver: jabra,snd-usb-audio,usbhid interfaces: 4 rev: 2.0 speed: 12 Mb/s
    chip-ID: 0b0e:24c8 class-ID: 0300 serial: <filter>
  Hub-3: 1-2:23 info: Genesys Logic Hub ports: 4 rev: 2.1 speed: 480 Mb/s
    power: 100mA chip-ID: 05e3:0610 class-ID: 0900
  Device-1: 1-2.1:24 info: Cherry GmbH Mechanical Keyboard
    type: Keyboard,Mouse driver: hid-generic,usbhid interfaces: 2 rev: 2.0
    speed: 12 Mb/s power: 500mA chip-ID: 046a:0079 class-ID: 0301
  Device-2: 1-6:22 info: Logitech Unifying Receiver type: Keyboard,Mouse,HID
    driver: logitech-djreceiver,usbhid interfaces: 3 rev: 2.0 speed: 12 Mb/s
    power: 98mA chip-ID: 046d:c52b class-ID: 0300
  Device-3: 1-8:3 info: Chicony Integrated Camera (1280x720@30) type: Video
    driver: uvcvideo interfaces: 2 rev: 2.0 speed: 480 Mb/s power: 500mA
    chip-ID: 04f2:b604 class-ID: 0e02 serial: <filter>
  Device-4: 1-9:5 info: Synaptics Metallica MIS Touch Fingerprint Reader
    type: <vendor specific> driver: N/A interfaces: 1 rev: 2.0 speed: 12 Mb/s
    power: 100mA chip-ID: 06cb:009a class-ID: ff00 serial: <filter>
  Device-5: 1-11:6 info: Alcor Micro AU9540 Smartcard Reader type: Smart Card
    driver: N/A interfaces: 1 rev: 2.0 speed: 12 Mb/s power: 50mA
    chip-ID: 058f:9540 class-ID: 0b00
  Device-6: 1-14:7 info: Intel Bluetooth 9460/9560 Jefferson Peak (JfP)
    type: Bluetooth driver: btusb interfaces: 2 rev: 2.0 speed: 12 Mb/s
    power: 100mA chip-ID: 8087:0aaa class-ID: e001
  Hub-4: 2-0:1 info: Super-speed hub ports: 10 rev: 3.1 speed: 10 Gb/s
    chip-ID: 1d6b:0003 class-ID: 0900
  Hub-5: 2-2:3 info: Genesys Logic GL3523 Hub ports: 4 rev: 3.1 speed: 5 Gb/s
    chip-ID: 05e3:0620 class-ID: 0900
Sensors:
  System Temperatures: cpu: 52.0 C pch: 49.0 C mobo: N/A gpu: nvidia temp: 51 C
  Fan Speeds (RPM): fan-1: 0 fan-2: 0
Info:
  Processes: 300 Uptime: 7h 34m wakeups: 17659 Init: systemd v: 252
  default: graphical tool: systemctl Compilers: gcc: 12.2.1 clang: 15.0.7
  Packages: pm: pacman pkgs: 1215 libs: 337 tools: pamac pm: flatpak pkgs: 0
  Shell: Zsh v: 5.9 default: Bash v: 5.1.16 running-in: konsole inxi: 3.3.25