<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED NOTOURBUG - Display not recognized if initially disconnected"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=110806#c4">Comment # 4</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED NOTOURBUG - Display not recognized if initially disconnected"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=110806">bug 110806</a>
              from <span class="vcard"><a class="email" href="mailto:rropid@gmail.com" title="Ropid <rropid@gmail.com>"> <span class="fn">Ropid</span></a>
</span></b>
        <pre>I got this to work right with LightDM. Looking at "man sddm.conf", it seems the
same method could also work with SDDM.

I created the following three scripts inside "/etc/lightdm/":

------------------------------------------------------------
$ tail -n+1 display-setup session-setup xrandr-auto.sh 
==> display-setup <==
#!/bin/bash
/etc/lightdm/xrandr-auto.sh &

==> session-setup <==
#!/bin/bash
pkill -x xrandr-auto.sh

==> xrandr-auto.sh <==
#!/bin/bash
trap 'kill -- $(jobs -p)' EXIT
LC_ALL=C xev -root -event randr |
while read -r line; do
    # trigger only on certain lines
    if [[ $line == "RRScreenChangeNotify event"* ]]; then
        echo "$(date +%H:%M:%S.%N): screen change event"
        # in background, sleep a bit and run xrandr --auto
        # and don't start multiple background jobs
        if [[ ! $(jobs) ]]; then
            {
                sleep 1;
                echo "$(date +%H:%M:%S.%N): run xrandr"
                xrandr --auto
            } &
        fi
    fi
done
------------------------------------------------------------

And then in "/etc/lightdm/lightdm.conf", I configured the following:

[Seat:*]
display-setup-script=/etc/lightdm/display-setup
session-setup-script=/etc/lightdm/session-setup


The interesting part is inside "xrandr-auto.sh". That script uses 'xev' to
capture screen change events and it runs "xrandr --auto" when those events
happen. This seems to solve the problem here for me. I can now boot without a
monitor being connected, and when I connect the monitor the login screen will
show up correctly.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>