MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Rpi 4 and two monitors

    Scheduled Pinned Locked Moved Hardware
    60 Posts 6 Posters 34.7k Views 6 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N Offline
      NathTheDude
      last edited by

      @sdetweil , so using ‘0’ or ‘0.0’ give the same result and start MM on the first monitor.

      So far I have tried 1,2,3,4,5,6,7,8,9 and 0.1, 0.2, 0.3, 0.4, 0.5

      How far do I go? :)

      O 1 Reply Last reply Reply Quote 0
      • O Offline
        OldSunGuy @NathTheDude
        last edited by

        @NathTheDude The 2nd monitor should be display 0, screen 1. Use this:

        DISPLAY=:0.1
        
        1 Reply Last reply Reply Quote 0
        • N Offline
          NathTheDude
          last edited by NathTheDude

          Hey @OldSunGuy , thanks. ‘0’ and ‘0.0’ seem to be the first monitor however I get an error when I try anything else. So far I have tried using each of the following: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9

          Each time I try to start npm (npm start) apart from when I use 0 or 0.0 I get the following (with the value reflecting the number I changed in ‘run-start.sh’):

          (electron:2238): Gtk-WARNING **: 06:14:02.236: cannot open display: :0.1
          

          @sdetweil - not sure if this is relevant but it does not seem to matter what value I set in ‘run-start.sh’, when I reboot the pi it will always start MM on the first screen. Should it not fail if it is using ‘run-start.sh’?

          Also with an incorrect value being added to ‘run-start.sh’, when I run ‘mm.sh’ this always works and displays MM on the first screen.

          okay, I think I understand it now. When I reboot it is using ‘mm.sh’, within mm.sh is the following:

          cd ~/MagicMirror
          DISPLAY=:0 npm start
          

          Which I assume means that the ‘run-start.sh’ is not used during boot up?

          When I change this value to anything other than 0, this will also fail with the same error seen when trying to run npm previously.

          O 1 Reply Last reply Reply Quote 0
          • O Offline
            OldSunGuy @NathTheDude
            last edited by

            @NathTheDude If you start a terminal on one desktop and run:

            echo $DISPLAY
            

            Then start a terminal on the other desktop and run:

            echo $DISPLAY
            

            do you get the same results?

            1 Reply Last reply Reply Quote 0
            • N Offline
              NathTheDude
              last edited by

              @OldSunGuy - I get :0.0

              I wonder if both screens are being seen as 0.0, if that is the case I guess I would expect the MM screen to cover both screens and not just the first :-/

              1 Reply Last reply Reply Quote 0
              • N Offline
                NathTheDude
                last edited by

                @OldSunGuy , sorry mis read your comment. Not sure how I would start a terminal on one screen and a different terminal on another.

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil @NathTheDude
                  last edited by

                  @NathTheDude if they are two independent desktops, then you should have a menu on the second desktop, just like the first…

                  also, you can move the mouse to the second desktop and do ctrl-alt-t to open a terminal there

                  I have an micro hdmi adapter coming later today so I can put up a second physical display on my pi4…

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  1 Reply Last reply Reply Quote 0
                  • N Offline
                    NathTheDude
                    last edited by

                    @sdetweil , I opened up a terminal session on each screen and both indicated the same display was being used (:0).

                    From the ‘Appearance Settings’ window (‘Prefences’ > ‘Apprearance Settings’, there is a ‘Taskbar’ tab and in this tab you select which hdmi output you want the taskbar to be on. You can choose both.

                    S N 2 Replies Last reply Reply Quote 0
                    • S Offline
                      sdetweil @NathTheDude
                      last edited by

                      @NathTheDude so, it looks like one big desktop…

                      u should be using Buster OS, right? so you can see the temples across the big image, some on the right display, some on the left…

                      NOT the same on both?

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      N 1 Reply Last reply Reply Quote 0
                      • N Offline
                        NathTheDude @sdetweil
                        last edited by

                        @sdetweil , yeah buster.

                        I can see temples on both screens, the image does not flow between screens. When looking at the 'Appearance Settings’, the is a tab for each HMDI with different settings but these are purely for what image is seen on the desktop. You can use the same image on both desktops however this is purely related to the desktop image or so is what I understand of it.

                        1 Reply Last reply Reply Quote 0
                        • N Offline
                          NathTheDude @NathTheDude
                          last edited by

                          @NathTheDude said in Rpi 4 and two monitors:

                          @sdetweil , I opened up a terminal session on each screen and both indicated the same display was being used (:0).

                          From the ‘Appearance Settings’ window (‘Prefences’ > ‘Apprearance Settings’, there is a ‘Taskbar’ tab and in this tab you select which hdmi output you want the taskbar to be on. You can choose both.

                          Sorry, with my previous comment - I meant to say you ‘CANT’ choose both (taskbar can only be on one screen/output).

                          S 1 Reply Last reply Reply Quote 0
                          • S Offline
                            sdetweil @NathTheDude
                            last edited by

                            @NathTheDude there is a firmware update on the pi4… execute

                            sudo rpi-update
                            

                            Sam

                            How to add modules

                            learning how to use browser developers window for css changes

                            1 Reply Last reply Reply Quote 0
                            • N Offline
                              NathTheDude
                              last edited by

                              @sdetweil , so I did the firmware update and rebooted.

                              Slightly different now but still can not quite get this to work. When I now run a terminal on screen 1 the output of ‘echo $DISPLAY’ is ‘:0.0’ and when I run the terminal on the 2nd window the output is ‘:0’. However the same is seen when I try to either user ‘0’ or ‘0.0’ in run.sh (mm gets display on the 1st monitor.

                              I have again tried to use different numbers (1,2,3 and 0.1, 0.2, 0.3) but again, these are not valid entries.

                              S 1 Reply Last reply Reply Quote 0
                              • S Offline
                                sdetweil @NathTheDude
                                last edited by

                                @NathTheDude how about the output of xrandr -q

                                Sam

                                How to add modules

                                learning how to use browser developers window for css changes

                                N 1 Reply Last reply Reply Quote 0
                                • N Offline
                                  NathTheDude @sdetweil
                                  last edited by

                                  @sdetweil . I get the following when trying to run different xrandr commands:

                                  Can't open display
                                  
                                  1 Reply Last reply Reply Quote 0
                                  • N Offline
                                    NathTheDude
                                    last edited by

                                    @sdetweil - ahhh. I need to do this from the desktop:

                                    pi@MagicMirrors:~ $ xrandr -q
                                    Screen 0: minimum 320 x 200, current 2160 x 1920, maximum 7680 x 7680
                                    HDMI-1 connected primary 1080x1920+0+0 left (normal left inverted right x axis y axis) 477mm x 268mm
                                       1920x1080     60.00*+  60.00    50.00    59.94  
                                       1680x1050     59.88  
                                       1280x1024     75.02    60.02  
                                       1440x900      59.90  
                                       1280x960      60.00  
                                       1280x720      60.00    60.00    50.00    59.94  
                                       1024x768      75.03    70.07    60.00  
                                       832x624       74.55  
                                       800x600       72.19    75.00    60.32    56.25  
                                       720x576       50.00    50.00    50.00  
                                       720x480       60.00    60.00    59.94    59.94    59.94  
                                       640x480       75.00    72.81    66.67    60.00    59.94    59.94  
                                       720x400       70.08  
                                    HDMI-2 connected 1080x1920+1080+0 right (normal left inverted right x axis y axis) 477mm x 268mm
                                       1920x1080     60.00*+  60.00    50.00    59.94  
                                       1680x1050     59.88  
                                       1280x1024     75.02    60.02  
                                       1440x900      59.90  
                                       1280x960      60.00  
                                       1280x720      60.00    60.00    50.00    59.94  
                                       1024x768      75.03    70.07    60.00  
                                       832x624       74.55  
                                       800x600       72.19    75.00    60.32    56.25  
                                       720x576       50.00    50.00    50.00  
                                       720x480       60.00    60.00    59.94    59.94    59.94  
                                       640x480       75.00    72.81    66.67    60.00    59.94    59.94  
                                       720x400       70.08  
                                    pi@MagicMirrors:~ $ 
                                    
                                    S 1 Reply Last reply Reply Quote 0
                                    • S Offline
                                      sdetweil @NathTheDude
                                      last edited by

                                      @NathTheDude ok, I can see the same results now that I have my adapter…

                                      may have to wait til tomorrow to work on it…

                                      Sam

                                      How to add modules

                                      learning how to use browser developers window for css changes

                                      1 Reply Last reply Reply Quote 0
                                      • N Offline
                                        NathTheDude
                                        last edited by NathTheDude

                                        Hey @sdetweil , no problem at all - no rush indeed. Thank you for your help thus far.

                                        So thanks to this page I have been able to run up two chromiums, one on each page but I have started up chromium directly via terminal from the desktop. Not quite figured out how to implement this as two MM’s and if running up two at once would kill the CPU.

                                        raspberrypi.org forum post

                                        1st terminal session

                                        DISPLAY=:0 /usr/bin/chromium-browser \
                                        --noerrdialogs \
                                        --kiosk \
                                        --window-position=0,0 \
                                        --start-fullscreen \
                                        --user-data-dir=Default
                                        

                                        2nd terminal session

                                        DISPLAY=:0 /usr/bin/chromium-browser \
                                        --noerrdialogs \
                                        --kiosk \
                                        --window-position=1920,0 \
                                        --start-fullscreen \
                                        --user-data-dir=‘Test2’
                                        
                                        S 1 Reply Last reply Reply Quote 0
                                        • S Offline
                                          sdetweil @NathTheDude
                                          last edited by sdetweil

                                          @NathTheDude copy one MM folder tree to MagicMirror1

                                          then change the config on MM1 to use a different port (8081 maybe)

                                          then start both MM in serverOnly mode (u can set that in config.js too, serverOnly: true,

                                          then launch your two browsers, with the url pointing to separate MM’s…
                                          –app=http://localhost:MM_port,
                                          –app=http://localhost:MM1_port

                                          you can edit the run-start.sh on MM1 to add the

                                          --window-position=1920,0 \
                                          --user-data-dir=‘Test2’
                                          

                                          parms to the ones already provided

                                          then change both MM configs to serverOnly: “local”,
                                          and it will launch the chrome browser for you
                                          (this is what we call split mode, using a separate browser)

                                          then u can have pm2 start both of those when the system boots…
                                          have to change the mm.sh in MM1/installers, and maybe the json file title to MagicMirror1, and point to the local mm.sh

                                          Sam

                                          How to add modules

                                          learning how to use browser developers window for css changes

                                          1 Reply Last reply Reply Quote 1
                                          • N Offline
                                            NathTheDude
                                            last edited by NathTheDude

                                            Hey @sdetweil , thanks for the info on this - I am grateful.

                                            I think I am nearly there but just missing a bit or two.

                                            I copied the ‘MagicMirror’ to ‘MagicMirror2’ folder, updated the config.js, run-start.sh and the pm2_MagicMirror.json files.

                                            When I reboot I now get MM and MM2 load up but both on the same screen.

                                            I have messed around with the chromium line from the ‘run-start.sh’ and I don’t think it is actually be used in this case, I even commented the line out and this did not prevent me from running ‘npm start’ and MM2 still loaded albeit on top of the first MM.

                                            Any ideas on where it is getting it’s info on how to start up chromium?

                                            Thanks

                                            Nathan

                                            S 1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 3
                                            • 2 / 3
                                            • First post
                                              Last post
                                            Enjoying MagicMirror? Please consider a donation!
                                            MagicMirror created by Michael Teeuw.
                                            Forum managed by Sam, technical setup by Karsten.
                                            This forum is using NodeBB as its core | Contributors
                                            Contact | Privacy Policy