Reset displays on display config changes

I usually have an external display on, connected via a docking station HDMI port or the built-in HDMI port. I like to have my main laptop display off. When I disconnect the HDMI in either of those cases, my main display doesn’t turn on.

I would like it to be on when there are no matching display profiles.

A partial workaround: add a keyboard shortcut (say, WinKey+P) to XFCE that resets all available displays with xrandr or something, but that doesn’t solve the use case where I suspend my laptop, then take it with me for a meeting (thus disconnecting the HDMI), and then when I open it in the meeting room my laptop display doesn’t turn on. In that case the laptop will be in the login screen, and WinKey+P doesn’t work since the login screen is separate from whatever I set for my session, right? Or is there a way to work around this? I also mistype my pw sometimes, so I might get stuck in that situation.

(This meeting scenario that I describe could also be slightly different, it hasn’t happened for a while. Maybe it takes me to the login screen after suspend, lets me log in, and then turns the main display off because that’s what it was set to previously, even though the external HDMI is now gone. Very frustrating :smile:)

Is there a setting for the whole system (so also for the login screen) that ensures if a display is disconnected, and none of the profiles match, all available displays are reset, instead of maintaining a (broken/incomplete) previous configuration?

Fun thing is, if I have my screens to extend, it works just the way I want, i.e. whenever I disconnect the HDMI it reverts to single screen mode. So I’m hoping this can be fixed by making the XFCE display config a bit smarter…

Laptop info:

$ inxi -Fxxx
System:
  Host: kirk Kernel: 5.12.0-1-MANJARO x86_64 bits: 64 compiler: gcc
  v: 10.2.0 Desktop: Xfce 4.16.0 tk: Gtk 3.24.24 info: xfce4-panel wm: xfwm4
  vt: 7 dm: LightDM 1.30.0 Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Laptop System: LENOVO product: 20TJS02U00 v: ThinkPad P1 Gen 3
  serial: <superuser required> Chassis: type: 10
  serial: <superuser required>
  Mobo: LENOVO model: 20TJS02U00 v: SDK0R32862 WIN
  serial: <superuser required> UEFI: LENOVO v: N2VET19W (1.04 )
  date: 07/10/2020
Battery:
  ID-1: BAT0 charge: 68.9 Wh (90.5%) condition: 76.1/80.4 Wh (94.7%)
  volts: 17.4 min: 15.4 model: SMP 5B10X19049 type: Li-poly serial: 2088
  status: Charging cycles: 44
  Device-1: hidpp_battery_0 model: Logitech M570 serial: 1028-5f-84-d7-e9
  charge: 70% rechargeable: yes status: Discharging
CPU:
  Info: 6-Core model: Intel Core i7-10750H bits: 64 type: MT MCP
  arch: Comet Lake rev: 2 cache: L2: 12 MiB
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  bogomips: 62431
  Speed: 800 MHz min/max: 800/5000 MHz Core speeds (MHz): 1: 800 2: 800
  3: 800 4: 800 5: 800 6: 800 7: 800 8: 800 9: 800 10: 800 11: 800 12: 801
Graphics:
  Device-1: NVIDIA TU117GLM [Quadro T1000 Mobile] vendor: Lenovo
  driver: nvidia v: 460.73.01 bus-ID: 01:00.0 chip-ID: 10de:1fb9
  class-ID: 0300
  Device-2: Acer Integrated Camera type: USB driver: uvcvideo bus-ID: 1-8:4
  chip-ID: 5986:115f class-ID: fe01
  Display: x11 server: X.Org 1.20.11 driver: loaded: nvidia
  unloaded: modesetting,nouveau alternate: fbdev,nv,vesa
  resolution: 1920x1080 s-dpi: 96
  OpenGL: renderer: Quadro T1000 with Max-Q Design/PCIe/SSE2
  v: 4.6.0 NVIDIA 460.73.01 direct render: Yes
Audio:
  Device-1: Intel Comet Lake PCH cAVS vendor: Lenovo
  driver: sof-audio-pci-intel-cnl bus-ID: 00:1f.3 chip-ID: 8086:06c8
  class-ID: 0401
  Device-2: Trust Gaming Microphone type: USB
  driver: hid-generic,snd-usb-audio,usbhid bus-ID: 1-5.4:8
  chip-ID: 145f:01c1 class-ID: 0300
  Sound Server-1: ALSA v: k5.12.0-1-MANJARO running: yes
  Sound Server-2: JACK v: 0.125.0 running: no
  Sound Server-3: PulseAudio v: 14.2 running: yes
  Sound Server-4: PipeWire v: 0.3.26 running: no
Network:
  Device-1: Intel Comet Lake PCH CNVi WiFi driver: iwlwifi v: kernel
  bus-ID: 00:14.3 chip-ID: 8086:06f0 class-ID: 0280
  IF: wlp0s20f3 state: up mac: fc:44:82:df:17:4a
  Device-2: Realtek RTL8153 Gigabit Ethernet Adapter type: USB driver: r8152
  bus-ID: 4-2.3:4 chip-ID: 0bda:8153 class-ID: 0000 serial: 001000001
  IF: enp44s0u2u3 state: down mac: a4:ed:43:30:3e:eb
Drives:
  Local Storage: total: 1.38 TiB used: 178.91 GiB (12.7%)
  ID-1: /dev/nvme0n1 vendor: Samsung model: SSD 970 EVO 1TB size: 931.51 GiB
  speed: 31.6 Gb/s lanes: 4 rotation: SSD serial: S5H9NS1NA42603X
  rev: 2B2QEXE7 scheme: GPT
  ID-2: /dev/nvme1n1 vendor: Toshiba model: N/A size: 476.94 GiB
  speed: 31.6 Gb/s lanes: 4 rotation: SSD serial: 909F7671FPV1 rev: 5108AGLA
  scheme: GPT
Partition:
  ID-1: / size: 470 GiB used: 178.88 GiB (38.1%) fs: ext4 dev: /dev/dm-0
  mapped: luks-4dfe2fee-ff48-44af-bfc5-ebea6a1e50a9
  ID-2: /boot/efi size: 256 MiB used: 29.5 MiB (11.5%) fs: vfat
  dev: /dev/nvme1n1p1
Swap:
  ID-1: swap-1 type: partition size: 16 GiB used: 0 KiB (0.0%) priority: -2
  dev: /dev/nvme0n1p1
Sensors:
  System Temperatures: cpu: 58.0 C mobo: 36.0 C gpu: nvidia temp: 35 C
  Fan Speeds (RPM): cpu: 2773 fan-2: 2510
Info:
  Processes: 357 Uptime: 4m wakeups: 7 Memory: 15.37 GiB
  used: 3.06 GiB (19.9%) Init: systemd v: 247 Compilers: gcc: 10.2.0
  clang: 11.1.0 Packages: 1585 nix-usr: 219 pacman: 1355 flatpak: 11
  Shell: Bash v: 5.1.0 running-in: tmux: inxi: 3.3.04