Skip to main content

xrandr needs the $DISPLAY variable set to tell it which X session it's manipulating, and that isn't being set in the cron environment.

xrandr could be working on your default local X session, or a second one that you started by running startx from a TTY, or a session to a remote display being forwarded over SSH, or a nested X session running inside another one using Xnest, etc. Without the $DISPLAY environment variable (or the --display command line argument) it can't know in general which session to connect to, so it bails out.

For example, the following command may resolve your issue:

DISPLAY=:0 /home/user/screens.sh 
godlygeek
  • 8.3k
  • 1
  • 30
  • 28