Thursday, January 16, 2025

HOW TO AUTOSTART A WEBSITE IN FULL SCREEN MOD IN RASPBERRY

By default, the System autostart is applied to all users and executes each time a user logs in.
The System autostart file is located here: /etc/xdg/lxsession/LXDE-pi/

1)sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

2)paste the below given command
@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@chromium-browser --kiosk https://www.google.com/
To save and exit the nano editor press CTRL-X, Y and then ENTER. You can use your preferred text editor if nano isn’t your first choice.
• The first 2 lines are important and must not be removed and must also be present if doing the User method. If you have made an autostart file without these lines, the desktop will boot to a blank (Openbox) screen. To recover, right click anywhere on the screen and select terminal from the menu. Then edit autostart and add those 2 lines.

• The xscreensaver command is only relevant if you have installed xscreensaver. If not then it can be removed or just ignored.

• The @ is optional. With @ present, if there is an error on first try, the system will attempt to run the command up to 4 more times before giving up.

• Note that the autostart file is not a bash script and is processed differently. The commands in the autostart file are processed independently at near the same time in a parallel fashion. Or the system does not wait for the previous command to complete before starting the next command. If you have multiple commands that are dependent on being run in a specific order then you would need to put your commands in a bash script, then call your bash script from autostart.

• All programs launched by autostart run in the background so no need to use & at the end of the command.

• It is important to use the complete paths to scripts in autostart. Also calls within a script need to have the complete path specified. Paths to installed apps are not required.

• Scripts must be made executable.

• If your script requires keyboard and/or console interaction, then use the lxterminal -e command. See examples and notes below.

• If your command or app requires network and does not seem to work from autostart, then try enabling the wait for network at boot option in sudo raspi-config

• In some rare cases you may need to add a delay before starting your script to give the Desktop more time to complete the booting process before your app starts. This can be done with a bash sleep command. Do not attempt to add the sleep command directly in autostart, it won’t work. Use the sleep command in a bash script instead.
3) sudo raspi-config
go to advanced ->wayland-> and  change option to X11

The autostart file doesn't work because the new OS runs wayland as a backend, not X11. I'm sure there is a better solution, using the new wayland backend, but mine is just switching back to X11, then the autostart file works again. You can do so in the "sudo raspi-config" menu and then selecting advanced options > wayland.

No comments:

Post a Comment

Command to test audio in rasberry pi

speaker-test -c 5 - t wav