I managed to fix this using this gist by Ryan Miller and changing LightDM configuration file. All you need is this script (remember to change PRIMARY_DISPLAY
in first, according to comment):
#!/bin/bash
#
# { 2017-07-02 16:20 }
# { Ryan Miller | [email protected] }
# { /usr/local/bin/correct-screen-pantheon-greeter }
#
# Set correct primary monitor for login screen when lightdm greeter starts up on Elementary OS.
# Change this variable to your primary display (Run 'xrandr -q' to see available displays)
PRIMARY_DISPLAY='HDMI-0'
# Get list of connected monitors
x_out=$(xrandr -q | grep -e '\( \)connected' | awk -F' ' '{ print $1 }')
# Safety - Check if PRIMARY_DISPLAY is connected; if not, bail out of script
[[ $(grep ${PRIMARY_DISPLAY} <<< ${x_out}) ]] || exit 0
# Iterate over x_out and disable all monitors except for PRIMARY_DISPLAY
for monitor in ${x_out[@]} ; do
if [[ ${monitor} = ${PRIMARY_DISPLAY} ]] ; then
xrandr --output ${monitor} --primary
else
xrandr --output ${monitor} --off
fi
done
and LightDM config file setting location of script:
#{ /etc/lightdm/lightdm.conf }
[Seat:*]
greeter-setup-script=/usr/local/bin/correct-screen-pantheon-greeter