title: Automatically run graphical python script on startup in ubuntu
body: <p>I have a python script that starts a fullscreen animation when run - how do i set this to start at startup in ubuntu 16.04? Other answers to the "script on startup" problem don't work - because I'm assuming they're executed before the desktop environment has a chance to start up...</p>
  
  <p>I have a script called "startup.sh" that reads as:</p>
  
  <pre><code>xrandr --output HDMI-0 -s 1280x1024
  
  source activate demo
  
  cd ~/demo/
  
  python run.py
  </code></pre>
  
  <p>Where the first line sets the correct resolution - the second line activates an anaconda environment, the third line changes directory (parts of the script need it to be in that directory, and the 4th line finally runs the script that launches a fullscreen graphic (using pygame, if it matters.)</p>
  
  <p>How can i set this to auto run after unity finishes setting up? Thanks so much... any help or comments at all are really appreciated...</p>
  
  <p>EDIT: it looks like someone here had a similar problem: <a href="https://www.raspberrypi.org/forums/viewtopic.php?t=128602" rel="nofollow noreferrer">https://www.raspberrypi.org/forums/viewtopic.php?t=128602</a></p>
  
  <p>They wanted to start a pygame script on startup - and were able to do so after their desktop environment loaded by putting a call to their program in <code>~/.config/lxsession/LXDE-pi/autostart</code> - I'm not using LXDE - i'm on unity, so is there an equivalent?</p>