0

I'm developing web-app that will run on terminal with two monitors (vertical set-up). On terminal there is installed linux mint. I need to open 2 different instances of google-chrome on 2 different monitors, but on same session.

So far I've reached this:

#clear any cache from previous run of terminal
rm -rf /dev/shm/Chrome 
mkdir -p /dev/shm/Chrome 

export DISPLAY=:0.0
exec /usr/bin/google-chrome \
    --display=":0.0" \
    --new-window \
    --no-sandbox \
    --disable-setuid-sandbox \
    --start-maximized \
    --kiosk-printing \
    --start-fullscreen \
    --user-data-dir=/dev/shm/Chrome \
    --no-first-run \
    'http://google.com/'

second script

#second instance started in different place

export DISPLAY=:0.1
exec /usr/bin/google-chrome \
    --display=":0.1" \
    --new-window \
    --no-sandbox \
    --disable-setuid-sandbox \
    --start-maximized \
    --kiosk-printing \
    --start-fullscreen \
    --user-data-dir=/dev/shm/Chrome \
    --no-first-run \
    'http://google.com/'

It does: open two different windows of google chrome & opens them full screen.

However, if they share profile (in this case --user-data-dir=/dev/shm/Chrome) they will open on same display.

If it is different folder for them, then they will open on different monitors, but they will not share same session, which I do need for further development. I plan to use broadcast-channel-api, example could be found here: https://github.com/irekrog/broadcast-channel-api-simple-example . If Chrome does not share session, it is impossible to communicate with broadcast channel.

note: also tag --window-position=X,Y does not seem to work and just breaks everything if they're on same session

There is clone of this question for windows: How to open two instances of Chrome kiosk mode in different displays (Windows) But I need solution for linux, I don't believe I have access to WinApi as in accepted answer there.

Any solutions or workaround are appreciated

Andrii Plotnikov
  • 3,022
  • 4
  • 17
  • 37
  • I take it you mean "session" in the sense of Chrome "browsing sessions". Note that this terminology collides with the POSIX process-management concept of a "session". – John Bollinger Jul 03 '19 at 13:58
  • Anyway, I don't see how the script you present can possibly have the effect you claim it does. When successful, the `exec` command *replaces* the current shell with the the program it starts, so your second `exec` will never be reached if your first indeed does start a Chrome instance. – John Bollinger Jul 03 '19 at 14:03
  • @JohnBollinger it's two different scripts... I'll correct answer so that it's more obvious. – Andrii Plotnikov Jul 04 '19 at 08:10
  • Would it be acceptable to gang your two screens together into one big logical screen? Xinerama mode can do that, for example, and some X drivers can do that at the driver level. Then both Chromes could run on the same display. – John Bollinger Jul 04 '19 at 12:24
  • @JohnBollinger how would they both run in full-screen mode in that case? If I understand correctly, that would make it impossible. I will look at it, but I think that would not work in my case. – Andrii Plotnikov Jul 04 '19 at 13:09
  • They would not run full-screen, @Andrii. Instead, they would each be sized and positioned to exactly fill one physical screen. This indeed might not be acceptable, but if it is acceptable then it would provide a relatively simple way forward. – John Bollinger Jul 04 '19 at 14:23

0 Answers0