I use autologin of lightdm to skip login GUI and redirect desktop to my own session.
So after boot, it will directly go to my script set in my_session.desktop
script bellow:
Invalid MIT-MAGIC-COOKIE-1 keyCan't open display :0
Invalid MIT-MAGIC-COOKIE-1 keyCan't open display :0
Invalid MIT-MAGIC-COOKIE-1 keyCan't open display :0
But if I restart lightdm, output of xrandr will be ok.
I think this is because some Nvidia driver’s not ready when lightdm start at boot. It sets DISPLAY=:0 anyway no mater whether it is ready or not indeed.
How can I solve this problem without restart lightdm? I can add some wait time before lightdm service but I don’t know how to check ready or pick which service as exec before?