You are not logged in.
As strange as it sounds: after I plug in Logitech mouse receiver into a laptop, external monitor starts to randomly disconnect every 5-10 minutes or so. This started to happen after recent update, before that I hadn't updated packages for a few months or so.
Setup:
Dell Inspiron 7566 laptop
kernel 5.2.9-arch1-1-ARCH
xorg-server 1.20.5-2
Initially monitor was connected via Displaylink docking station, so I thought it must be displaylink since there's a similar known issue. But even after I plugged monitor directly via HDMI cable, stopped displaylink service and unloaded evdi driver issue continues to happen.
Nothing particularly interesting happens in log journalctl:
Sep 01 16:37:21 kev-drobyshevskyi-lx runuser[11001]: pam_unix(runuser:session): session opened for user ivan by (uid=0)
Sep 01 16:37:21 kev-drobyshevskyi-lx kernel: audit: type=1006 audit(1567345041.496:167): pid=11001 uid=0 old-auid=4294967295 auid=1000 tty=(none) old-ses=4294967295 ses=43 res=1
Sep 01 16:37:21 kev-drobyshevskyi-lx systemd[1]: Started Session 43 of user ivan.
Sep 01 16:37:22 kev-drobyshevskyi-lx runuser[11001]: pam_unix(runuser:session): session closed for user ivan
Sep 01 16:37:22 kev-drobyshevskyi-lx systemd[1]: session-43.scope: Succeeded.udevadm monitor
KERNEL[13037.693406] change /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.2/1-3.2.2/1-3.2.2:1.1/0003:046D:C52F.0004/0003:046D:4055.0006/power_supply/hidpp_battery_0 (power_supply)
UDEV [13039.242455] change /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.2/1-3.2.2/1-3.2.2:1.1/0003:046D:C52F.0004/0003:046D:4055.0006/power_supply/hidpp_battery_0 (power_supply)Offline
Figured that out eventually, clue was in udevadm monitor log.
Bluetooth mouse sometimes reports power_supply events (may be notifying about AAA battery level?), and my custom udev script mistook it for "AC unplugged" event, disconnecting external monitor.
Offline