[Unit] Description=Detect second DISPLAY using xrandr [Service] Type=oneshot ExecStart=/bin/bash -c 'export DISPLAY=$DISPLAY.1; xrandr -q | grep "connected" && echo "DISPLAY=$DISPLAY" > ~/.second_display || rm -f ~/.second_display' [Install] WantedBy=yavdr-desktop.target