I'm using XFCE desktop and made a script to use after debian installation for automatically expanding desktop to second monitor after boot :
cat <<-"EOF" > /usr/local/bin/display
#!/bin/bash
sleep 3
xrandr --listproviders \
&& xrandr --setprovideroutputsource 1 0 \
&& xrandr --output DP-1-1 --right-of LVDS-1
EOF
chmod +x /usr/local/bin/display && chmod 755 /usr/local/bin/display
mkdir -p "$HOME"/.config/autostart
cat <<-"EOF" > "$HOME"/.config/autostart/display.desktop
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=display
Comment=
Exec=/usr/local/bin/display
OnlyShowIn=XFCE;
StartupNotify=false
Terminal=false
Hidden=false
EOF
This works reasonably well , all though occasionally it mirrors the desktop instead of expanding .
Just switching from Xubuntu to debian stretch and I was wondering if there is some more reliable way to do this ?