sotonpete
Posts: 6
Joined: Fri Jun 08, 2012 11:34 pm

Launch Chromium browser on second display?

Fri Jul 12, 2019 8:59 pm

Hi all,

I'm currently using a Pi to run a Kiosk dashboard for a charity call-centre, and having just upgraded to a Pi 4 I would like to attach a 7" touchscreen as well, to act as a control panel.

I've connected the 7" screen, and it's showing the same background picture as the main HDMI output, however I can't find a way of launching chromium-browser on that second screen (like I do on the first screen).

For the first screen I run...
DISPLAY=:0 /usr/bin/chromium-browser -force-device-scale-factor=1 --noerrdialogs --kiosk --incognito http://localhost:8080
Having done some Googling I've found that the command...
(cd /tmp/.X11-unix && for x in X*; do echo ":${x#X}"; done)
...which should list all displays known to X11, however it only returns one...
:0
If anybody has achieved this then I'd be most grateful to hear how!!

My build is Raspbian Buster

Many thanks,
Pete Bunting, UK.

User avatar
topguy
Posts: 6466
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Launch Chromium browser on second display?

Sat Jul 13, 2019 1:22 pm

Can you drag the chrome window (or any other window) with the mouse from one screen to the other ?

Each X-server ( :0 , :1 etc. ) can have sub displays.. you address those with adding another number.
See how these commands work.

Code: Select all

DISPLAY=:0.0  xeyes
DISPLAY=:0.1  xeyes
Edit:
xeyes are just a small app that shows some eyes that follow your mouse.. if for some reason its not installed you find it in the "x11-apps" package.

sotonpete
Posts: 6
Joined: Fri Jun 08, 2012 11:34 pm

Re: Launch Chromium browser on second display?

Sat Jul 13, 2019 1:50 pm

Thanks for the response.

I've just tried that and I get the eyes on the main screen using either...
DISPLAY=:0.0 xeyes
or
DISPLAY=:0 xeyes
...however if I try 0.1 I get...
DISPLAY=:0.1 xeyes
Error: Can't open display: :0.1
I think the issue is that the X windowing system is not aware of that second hardware screen?!?!

User avatar
topguy
Posts: 6466
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Launch Chromium browser on second display?

Sat Jul 13, 2019 2:18 pm

Can you drag the chrome window (or any other window) with the mouse from one screen to the other ?
Did you try this ? If its just an extended desktop I wound expect it to be "to the right of" or "below" the main deskop.

Since the second screen is showing the desktop-background it should be under control of the X-server. Isnt there a control/configuration panel for "display" somewhere ?

Also the output of the command "xrandr" ( ref: https://wiki.archlinux.org/index.php/Xrandr ) might tell us how it is configured.

I dont have a Raspbian Buster to test on yet, so I admit to taking a few stabs in the twilight here. Someone that knows exactly how it works might be back to work on monday.

sotonpete
Posts: 6
Joined: Fri Jun 08, 2012 11:34 pm

Re: Launch Chromium browser on second display?

Mon Jul 15, 2019 8:49 pm

Apologies for the delay in replying - I didn't have a mouse in the house! :)

So, now i've attached a mouse to the Pi I've found that it does indeed know about the second screen, and I can move the mouse cursor from one screen to the other!

Right clicking the desktop shows me that I have two Desktops - so I can configure separate backgrounds to each - even though they are in fact one constant flowing expanse.

I started to look at commands such as wmctrl to try and launch Chrome on one specific desktop, however on running...
DISPLAY=:0 wmctrl -d
...I got the response...
0 * DG: 2944x1080 VP: 0,0 WA: 0,0 2944x1080 desktop 1
...showing that as far as X was concerned, it was one screen.

I've now found that I can launch Chrome on to that second window using...
DISPLAY=:0 /usr/bin/chromium-browser \
--noerrdialogs \
--kiosk \
--incognito \
--window-position=1920,0 \
http://localhost:8080/secondpage
...and all is as I'd hoped!!

Many thanks for your input topguy! :)

Regards,
Pete.

Jon7sky
Posts: 2
Joined: Wed Mar 11, 2020 4:03 pm

Re: Launch Chromium browser on second display?

Wed Mar 11, 2020 4:10 pm

So how do you get a browser running on BOTH displays? I tried this:

Code: Select all

$ chromium-browser --window-position=0,0 https://www.google.com &
$ chromium-browser --window-position=1920,0 https://www.google.com &
But that made one browser with two tabs. So then I threw in the --new-window option, and that made two windows, but it put the second window on top of the first.

It's weird. Starting one browser at either 0,0 or 1920,0 works as expected, but the second one never goes where I told it to go.

Jon7sky
Posts: 2
Joined: Wed Mar 11, 2020 4:03 pm

Re: Launch Chromium browser on second display?

Thu Mar 12, 2020 4:12 pm

I found a clue on another forum. If I add the --user-data-dir option to specify two different directories for each of the instances of the browsers, they behave properly.

Code: Select all

$ chromium-browser --window-position=0,0    --kiosk --user-data-dir="/home/pi/Documents/Profiles/0" https://theslideshow.net/#simple/dog
$ chromium-browser --window-position=1920,0 --kiosk --user-data-dir="/home/pi/Documents/Profiles/1" https://theslideshow.net/#simple/llama

Return to “Advanced users”