This is an issue I have tried to solve for a long time, how can you automatically open two or more Chromium browsers on boot, on different monitors with different URLs, and also in fullscreen?
That is what this guide is about, because as far as I know this is the only existing complete guide out there.
This post is based on Raspberry Pi OS (Raspbian), but a lot of it should apply for linux in general.
Why do you want this? It depends, but showing different web-based dashboards or info screens without any user-input on boot (after power-loss) could be the reason. In my case I want to show a weather forecast website on the first display and a bus schedule website on the other one.
Read on for guidance!
Creating shell scripts
We need to create a script for each Chromium window, in this case two.
Start by making a folder for the script, this is optional but just to make it tidy.
Create a .sh file inside and open it in the nano editor.
Now, in this file you will write the command to open the first chromium instance. and than save the file.
TIP: Test the command in the normal CLI first to see how it works.
chromium-browser --noerrdialogs --disable-infobars --app="https://flemmingss.com" --start-fullscreen --window-position=0,0 --user-data-dir=$(mktemp -d) --enable-features=OverlayScrollbar
Explanation of chromium-browser parameters :
--noerrdialogs → Prevents error dialog boxes to show
--disable-infobars → Prevents infomration bar to show information
--app="https://flemmingss.com" → What url to open, change this
--start-fullscreen → make the window fullscreen
--window-position=0,0 → Where the window i starting.
0,0 means at the start/edge of the first display, 0,0 is where the first windows should start. For the second monitor the first value should be equal to the amount of pixels in the width of the first display. Example: If the first display is 1920×1080 the first value should be 1920. The second value does not need to be changed in this case as it refers to the vertical position which should be equal, or 0 in this case. So “1920,0” for the second monitor.
--user-data-dir=$(mktemp -d) → The “profile” or data directory. If this is not changed the default will be used, however, if it is using the same user-data-dir the second instance will just take the place of the first one and you will end up with just one window.
$(mktemp -d) should make a unique temporary directory, but you can replace this with your own directory. You just need a different one for each windows you plan to open.
--enable-features=OverlayScrollbar → Hiding the scrollbar on websited to make it look better.
--kiosk → Not required, and I have not included it, but it can be set to prevent users closing the window.
Create a new script for the second monitor
The content should be almost the same as the first one, but change –app= and –windows-position= according to the description above in “First monitor”.
chromium-browser --noerrdialogs --disable-infobars --app="https://www.raspberrypi.com" --start-fullscreen --window-position=1920,0 --user-data-dir=$(mktemp -d) --enable-features=OverlayScrollbar
First make the scripts executable
chmod +x ~/scripts/start_chromium-monitor1.sh chmod +x ~/scripts/start_chromium-monitor2.sh
Add them to auto-start by editing this file
Write the following and save:
@lxpanel --profile LXDE-pi @xset s off @xset -dpms @xset s noblank @/home/flemmingss/scripts/start_chromium-monitor1.sh @/home/flemmingss/scripts/start_chromium-monitor2.sh
Replace flemmingss in the two last lines with your username.
@lxpanel --profile LXDE-pi → This one is starting the GUI, if this is not specified the LXDE GUI will not start, this one is not required but I find it nice to have in the backround for diagnostic purposes.
@xset s off → Disable screen saver blanking
@xset -dpms → Turn off DPMS (Display Power Management Signaling)
@xset s noblank → Disable monitors to go blank/off.
@/home/monitor/scripts/start_chromium-monitor1.sh → Starting the first script
@/home/monitor/scripts/start_chromium-monitor2.sh → Starting the second script
Thats it! Do a reboot and it should work. One chromium-browser with the supplied URL should open in fullscreen on each monitor.