Auto open realdash on 2.2.8 linux w pi 4B

You can configure a GUI program to start automatically on boot in Raspberry Pi OS using one of several methods.

Method 1: LXDE Autostart

If you are using the desktop environment LXDE (Lightweight X11 Desktop Environment), which is used by Raspberry Pi OS, you can put a .desktop file in the autostart directory. Here’s how to do that:

  1. Open Terminal.

  2. Type this command and hit enter:

    nano ~/.config/lxsession/LXDE-pi/autostart
    
  3. Add the command to execute your program at the end of this file. It might look like this:

    @/usr/bin/realdash
    
  4. Save the file and exit nano (Ctrl+X, then Y, then Enter).

  5. Reboot to see the changes.

Method 2: systemd

If the first method doesn’t work, or you want a more powerful and flexible solution, you can use systemd, a system and service manager for Linux. Here’s how:

  1. Create a new systemd service file:

    sudo nano /etc/systemd/system/realdash.service
    
  2. Add the following to this file:

    [Unit]
    Description=RealDash
    
    [Service]
    ExecStart=/usr/bin/realdash
    Restart=always
    User=pi
    Environment=DISPLAY=:0
    Environment=XAUTHORITY=/home/pi/.Xauthority
    
    [Install]
    WantedBy=multi-user.target
    
  3. Save the file and exit nano (Ctrl+X, then Y, then Enter).

  4. Enable the service so that it starts on boot:

    sudo systemctl enable realdash.service
    
  5. Start the service immediately:

    sudo systemctl start realdash.service
    
  6. Check the status of the service:

    sudo systemctl status realdash.service
    

Remember that GUI applications usually require a display to connect to, which is why we’ve set the DISPLAY environment variable in the systemd service.

These instructions should help you automatically start a GUI application when your Raspberry Pi boots.

2 Likes