#!/bin/sh
XSS=xscreensaver

if [ "$1" = "off" ] ; then
    xrandr --output eDP-1 --mode 2256x1504 --auto
    # xrandr --output DP-2 --off
    # xrandr --output VGA1 --off
    if [ -x /usr/bin/${XSS} ] ; then
      nohup /usr/bin/${XSS} 2> /dev/null &
      sleep 1
      rm -f nohup.out
    fi
else
    xrandr --output eDP-1 --mode 1920x1080 --same-as DP-4

    if [ `ps ax | grep -v grep | grep -c "${XSS}"` -gt 0 ] ; then
	sudo killall ${XSS}
    fi
fi


echo "In case this does not work check eDP-0 instead!!"

echo "*****************************************************************"
echo "* Make sure you restart evince after changing screen resolution *"
echo "*****************************************************************"
