My screen layout script fails at system start


Not exactly sure if this is related to Bspwm at all but still seems relevant so I opened the topic here.

I have a dual monitor setup and recently decided to replace the places. One of them is DVI and other is DP. DVI one was my main monitor for years and now it’s secondary. Anyway, I have a script for a single monitor on startup and changed the script with the new one. I can run it manually and it works fine but on system start there happens to be a flashing a moment and it reverts back to DVI single setup.

I tried to delete the autostart line and was expecting it to open in dual setup but still happening the same.

Here is the script

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

I assume it’s not related to autostart, it seems DP just fails at startup somehow.

Also if it’s needed

~ >>> inxi -Fazy
  Kernel: 5.9.16-1-MANJARO x86_64 bits: 64 compiler: gcc v: 10.2.0
  parameters: root=UUID=ccb46516-3a3c-4c19-b622-21b6cddef426 rw quiet
  udev.log_priority=3 initrd=boot\initramfs-5.9-x86_64.img
  Desktop: bspwm 0.9.7-2-g342c2e3 info: lemonbar dm: LightDM 1.30.0
  Distro: Manjaro Linux
  Type: Desktop System: HP product: HP Pavilion Gaming Desktop 690-0xxx v: N/A
  serial: <filter> Chassis: type: 3 serial: <filter>
  Mobo: HP model: 843B v: 00 serial: <filter> UEFI: AMI v: F.31
  date: 05/27/2019
  Info: 6-Core model: Intel Core i5-9400F bits: 64 type: MCP arch: Kaby Lake
  note: check family: 6 model-id: 9E (158) stepping: A (10) microcode: B4
  L2 cache: 9 MiB
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  bogomips: 34814
  Speed: 800 MHz min/max: 800/4100 MHz Core speeds (MHz): 1: 800 2: 800 3: 800
  4: 800 5: 800 6: 800
  Vulnerabilities: Type: itlb_multihit status: KVM: VMX disabled
  Type: l1tf
  mitigation: PTE Inversion; VMX: conditional cache flushes, SMT disabled
  Type: mds mitigation: Clear CPU buffers; SMT disabled
  Type: meltdown mitigation: PTI
  Type: spec_store_bypass
  mitigation: Speculative Store Bypass disabled via prctl and seccomp
  Type: spectre_v1
  mitigation: usercopy/swapgs barriers and __user pointer sanitization
  Type: spectre_v2 mitigation: Full generic retpoline, IBPB: conditional,
  IBRS_FW, STIBP: disabled, RSB filling
  Type: srbds status: Vulnerable: No microcode
  Type: tsx_async_abort status: Not affected
  Device-1: NVIDIA TU116 [GeForce GTX 1660 Ti] vendor: Hewlett-Packard
  driver: nvidia v: 455.45.01 alternate: nouveau,nvidia_drm bus ID: 01:00.0
  chip ID: 10de:2182
  Display: x11 server: 1.20.10 compositor: picom v: git-dac85
  driver: nvidia resolution: <missing: xdpyinfo>
  OpenGL: renderer: GeForce GTX 1660 Ti/PCIe/SSE2 v: 4.6.0 NVIDIA 455.45.01
  direct render: Yes
  Device-1: Intel Cannon Lake PCH cAVS vendor: Hewlett-Packard
  driver: snd_hda_intel v: kernel alternate: snd_soc_skl,snd_sof_pci
  bus ID: 00:1f.3 chip ID: 8086:a348
  Device-2: NVIDIA TU116 High Definition Audio vendor: Hewlett-Packard
  driver: snd_hda_intel v: kernel bus ID: 01:00.1 chip ID: 10de:1aeb
  Device-3: Logitech HD Pro Webcam C920 type: USB
  driver: snd-usb-audio,uvcvideo bus ID: 1-9:7 chip ID: 046d:082d
  serial: <filter>
  Device-4: Logitech G430 Surround Sound Gaming Headset type: USB
  driver: hid-generic,snd-usb-audio,usbhid bus ID: 1-3:3 chip ID: 046d:0a4d
  Device-5: Blue Microphones Yeti Stereo Microphone type: USB
  driver: hid-generic,snd-usb-audio,usbhid bus ID: 1-5:4 chip ID: b58e:9e84
  serial: <filter>
  Sound Server: ALSA v: k5.9.16-1-MANJARO
  Device-1: Realtek RTL8821CE 802.11ac PCIe Wireless Network Adapter
  vendor: Hewlett-Packard driver: N/A modules: rtw88_8821ce port: 4000
  bus ID: 02:00.0 chip ID: 10ec:c821
  Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
  vendor: Hewlett-Packard driver: r8169 v: kernel port: 3000 bus ID: 03:00.0
  chip ID: 10ec:8168
  IF: enp3s0 state: up speed: 100 Mbps duplex: full mac: <filter>
  Local Storage: total: 4.31 TiB used: 3.31 TiB (76.9%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: SK Hynix
  model: BC501 HFM256GDJTNG-8310A size: 238.47 GiB block size: physical: 512 B
  logical: 512 B speed: 15.8 Gb/s lanes: 2 serial: <filter> rev: 80002C00
  temp: 27.9 C
  ID-2: /dev/sda maj-min: 8:0 vendor: Seagate model: ST4000DM004-2CV104
  size: 3.64 TiB block size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
  serial: <filter> rev: 0001
  ID-3: /dev/sdb maj-min: 8:16 model: SSD 480GB size: 447.13 GiB block size:
  physical: 512 B logical: 512 B speed: 6.0 Gb/s serial: <filter> rev: 7A
  ID-1: / raw size: 445.13 GiB size: 437.14 GiB (98.21%)
  used: 317.26 GiB (72.6%) fs: ext4 dev: /dev/sdb2 maj-min: 8:18
  ID-2: /boot/efi raw size: 100 MiB size: 96 MiB (96.00%)
  used: 28.6 MiB (29.8%) fs: vfat dev: /dev/nvme0n1p2 maj-min: 259:2
  Kernel: swappiness: 60 (default) cache pressure: 100 (default)
  ID-1: swap-1 type: partition size: 2 GiB used: 0 KiB (0.0%) priority: -2
  dev: /dev/sdb1 maj-min: 8:17
  System Temperatures: cpu: 41.0 C mobo: 27.8 C gpu: nvidia temp: 34 C
  Fan Speeds (RPM): N/A gpu: nvidia fan: 43%
  Processes: 222 Uptime: 3h 36m wakeups: 0 Memory: 31.23 GiB
  used: 3.04 GiB (9.7%) Init: systemd v: 247 Compilers: gcc: 10.2.0
  clang: 11.0.0 Packages: apt: 0 pacman: 1340 lib: 450 Shell: Zsh v: 5.8
  running in: server inxi: 3.2.01

Things to check for troubleshooting:

  • Where are you running your autostart script from?
    • Which user does it run as?
    • What environment variables are set ($DISPLAY might be relevant)
  • Is something else setting your monitors after the script runs? Do you need to add a sleep clause before it?
1 Like

Thank you for the reply.

After your message, I tried a couple things and I fixed it with adding sleep 1 && before the autostart command. Now it starts just as I wanted, though there is still a problem without using an autostart command, it still doesn’t start with dual monitor when there is no script running at startup. It’s a minor issue but still wondering what might cause that. I didn’t even set a screenlock or a sleep function.