2

i'm working on a Simple DIY Home Control project Language is Python, and GUI is PyQT5 The project is just some ESPs connected to a main Raspberry Pi (3B+) controller

The problem is that I'm trying to run the application at fullscreen, but i keep getting the Desktop to start, and then the app. What I need instead is only the application to start, without the Desktop and Applications bar to start.

Can you suggest me what I can try to use? I'm going to use a touch screen, and need to keep the ability to click to interact with the application itself.

Thanks in advance for every help you can give me. Kind regards

2
  • Do a google search for "rpi kiosk" and you will find lots of options/solutions for this. I have not done it myself, so cannot really say which option is better.
    – Chad G
    Feb 2, 2022 at 0:08
  • not really a Raspberry Pi question ... it is a Linux question ... research how to start a program instead of a DM (desktop manager)
    – jsotola
    Feb 2, 2022 at 1:13

1 Answer 1

1

Though this is not a Raspberry PI question, I am seeing this is being asked often nowadays

This is what worked for me with Raspberry Pi OS (Debian 10)

This was done on Debian with LXDE desktop. I wrote an automated setup script for my software, copying some snippet from that here.

Step 1. Disable the LXDE desktop:

I had commented out lxpanel and xscreensaver both from the default autostart and user autostart

  #DISABLE THE DESKTOP
  sudo sed -i 's/^@lxpanel/#@lxpanel/g' /etc/xdg/lxsession/LXDE/autostart
  sudo sed -i 's/^@xscreensaver/#@xscreensaver/g' /etc/xdg/lxsession/LXDE/autostart
  #DISABLE THE DESKTOP FOR THE USER
  sudo sed -i 's/^@lxpanel/#@lxpanel/g' /etc/xdg/lxsession/LXDE-${user_name}/autostart
  sudo sed -i 's/^@xscreensaver/#@xscreensaver/g' /etc/xdg/lxsession/LXDE-${user_name}/autostart
Step 2. Setup the application:

Note: I was using python3.7

#SETUP PYTHON VENV
python3 -m venv ${application_root_dir}/venv
cd ${application_root_dir}/venv
source ${application_root_dir}/venv/bin/activate

# Install external dependencies, if any
pip3 install <dependecny_name>

# Install your software
pip3 install <software>
deactivate
Step 3. Prepare for Autostart (optional):

Create Script to be executed in autostart. Note this is optional, you can directly use your command in the auto start (step 4).

tee -a ${application_root_dir}/start_my_app.sh > /dev/null << EOT
#!/bin/bash
cd ${application_root_dir}
source venv/bin/activate
python3 -m package.MyApp
deactivate
EOT

# Set execute permissions
sudo chmod 744 ${root_dir}/start_my_app.sh
Step 4. Setup Autostart:

Note: you can execute any command by setting ExecStart in [service]

4.1 Create a new service
# CREATE A SERVICE FILE
sudo tee -a /etc/systemd/system/my_app.service > /dev/null << EOT
[Unit]
Description=Start MY_APPLICATION
After=default.target
Wants=default.target

[Service]
User=${user_name}
Group=$user_group
Environment=DISPLAY=:0.0
Environment=XAUTORITY=/home/${user_name}/.Xauthority
ExecStart=/bin/bash -c "${root_dir}/start_my_app.sh"

[Install]
WantedBy=default.target
EOT
4.2 Register and enable the service
sudo /usr/bin/systemctl daemon-reload
sudo /usr/bin/systemctl enable my_app.service
4.3 Reboot
sudo reboot

Note: To enable the desktop back for troubleshooting (if at all required - I never needed though, as ssh was enabled in my case so I was using terminal). Uncomment the commented part of lxde deskop and reboot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.