Search code examples
bashraspberry-piautostart

can't get chrome tabs to open on startup on raspberry pi model 4


I'm trying to open 2 chrome windows when the raspberry pi starts up. I've wrote a bash script containing the following:

#!/bin/bash
PROFILE_PATH1="/home/screen/.config/chromium/Profile1"
PROFILE_PATH2="/home/screen/.config/chromium/Profile2"
# Open Chrome windows on startup
chromium-browser --user-data-dir=$PROFILE_PATH1 https://example.com/tab1 &
chromium-browser --user-data-dir=$PROFILE_PATH2 https://example.com/tab2

I tried running this command manually using bash open_chrome_tabs.sh and it works fine. So I added it to /etc/xdg/lxsession/LXDE-pi/autostart so that it now looks like this:

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@point-rpi
@bash /home/screen/open_chrome_tabs.sh

However after rebooting the pi, no chrome windows opened up.

I looked up some potential solutions online. I tried adding a 40 second bash sleep command to the bash script but but after waiting 40 seconds after boot... nothing.

I also tried running galculator from the autostart file by changing the file to look like this:

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@point-rpi
@galculator

But after rebooting, the calculator failed to start up. I tried running galculator manually and this worked fine as well. If all else fails I'll try to use crontab (never used it though), but I'd love to know what I'm doing wrong, any help would be appreciated. Thankyou!


Solution

  • problem solved! Turns out that the display server being used by the pi was wayland. I switched to x11 and then the above script executed fine