Posted on 4 Comments

Raspberry Pi – Running a program after the PIXEL desktop starts

Updated 21-4-2020 to correct typo.

To automatically run a python program when the PIXEL loads, you need to add a command to the autostart file that can be found here:

/etc/xdg/lxsession/LXDE-pi/autostart

Here’s the process:

  1. Open the autostart file: sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
  2. Create a new line above the line beginning: @xscreensaver
  3. On the new line add the command to start your program or script. NB: You should include the full path name
  4. Save and exit with ctl x then y then Enter.
  5. Next time the Pi boots, your program will run.

Mike – G4WNC

4 thoughts on “Raspberry Pi – Running a program after the PIXEL desktop starts

  1. This worked like a charm. Thanks!

    1. Hi Jay,

      Thanks for the feedback 🙂

  2. I am not sure if this is just outdated.. or a typo… but I did spend about 4 hours working on this issue. There are about 10,000 posts and methods to this. This was the one that worked.. so wanted to be sure to point out in case something gave up on it too early:
    Shouldnt this be:

    sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
    ?

    1. Hi Aaron,

      You’re correct, that is a typo. Thanks for spotting and reporting it. I’ve just updated the post so it should now be correct.

      Thanks,

      Mike

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.