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 35.0k 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

      Hey @sdetweil and @chassain-0 , so my kit for my v2 project has arrived. I have two 21.5 inch (same model) monitors connected up to an RPI4.

      I have had a look around the forum but not been able to see what the best method is for this. When we start pm2 or when the RPI reboots it will boot up with the MM on the first screen and the normal desktop seen on the 2nd screen.

      I think I would prefer to have two MM’s installed (one for each monitor), I assume this is ok todo or is the best approach to have the one MM on both screens?

      Thanks

      Nathan

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

        I wondered if I needed to update the ‘mm.sh’ file within the ‘installers’ folder, I tried changing this from ‘0’ to ‘1’ - reboot the RPI but on reboot MM does not get started on either monitor.


        pi@MagicMirrors:~/MagicMirror/installers $ tvservice --list
        2 attached device(s), display ID’s are :
        Display Number 2, type HDMI 0
        Display Number 7, type HDMI 1

        1 Reply Last reply Reply Quote 1
        • bheplerB Offline
          bhepler Module Developer @NathTheDude
          last edited by

          @NathTheDude - I tried that one-pi-two-instances thing a couple years ago. I wasn’t using an RPI but rather a tiny Ubuntu box. My problem was that I couldn’t find a way to guarantee which instance would appear on which monitor at start. They usually both ended up in the same monitor on top of each other.

          You may have more luck than I did. If you do figure it out, please let me know how you did it!

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

            @NathTheDude said in Rpi 4 and two monitors:

            think I would prefer to have two MM’s installed (one for each monitor), I assume this is ok todo or is the best approach to have the one MM on both screens?

            the answer is yes, … depends on what you want to do…

            to use two MM on the same full width display you will have to modify custom.css on the one to the right
            and make its starting position 1/2 way across the screen

            when MM is on the left, is the desktop a full image, or just the right side of the full image?

            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

              Hey @sdetweil , I started with stopping MM (pm2 stop all). This then allowed me to use VNC to change the screen settings, as in just rotate the screen’s display.

              The screens are showing as two seperate desktops and from VNC the mouse smoothly goes from one display to the other.

              When MM is started this completly fills the first screen and a raspbian windows desktop is seen on the 2nd screen.

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

                @NathTheDude try the raspian, preferences, appracne settings, desktop stretch across

                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

                  Thanks @sdetweil , I have just played with those settings again. These seem to only effect the desktop and the desktop background and not the MM site. Always appears on the first screen.

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

                    @NathTheDude but is the desktop all the way across as a single desktop, or two separate instances?

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

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

                      @sdetweil , it is seen as two separate monitors. There is not a setting to scretch one screen to the other with the settings. The closest is ‘Strectch to cover screen’ but that does not seem to help.

                      1 Reply Last reply Reply Quote 0
                      • bheplerB Offline
                        bhepler Module Developer @sdetweil
                        last edited by

                        @sdetweil - I don’t know if that capability is in the Raspi display drivers. It’s always going to see the two monitors as two separate devices with unique desktops. If you click on the Identify button, it should show you a different number on each monitor.

                        The only thing I can think of that would treat two monitors as a single continuous desktop is the AMD Eyefinity tech.

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

                          Thanks @sdetweil and @bhepler , could you point me in the direction of how I would display a seperate instance of MM each monitor? I know this would mean I would need to update/maintain two different MM’s but maybe that is a better option if I want to add various modules?

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

                            @bhepler said in Rpi 4 and two monitors:

                            I don’t know if that capability is in the Raspi display drivers. It’s always going to see the two monitors as two separate devices with unique desktops. If you click on the Identify button, it should show you a different number on each monitor.

                            well, that is stupid sh… , in this day and age you should be able to config the thing like u want…

                            I booted ubuntu on my desktop with has two displays and it made one big desktop by default…
                            can’t understand why raspi should be so dumb

                            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

                              does this help


                              pi@MagicMirrors:~ $ tvservice --list
                              2 attached device(s), display ID’s are :
                              Display Number 2, type HDMI 0
                              Display Number 7, type HDMI 1
                              pi@MagicMirrors:~ $

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

                                @NathTheDude MagicMirror startup in the run-start.sh file sets DISPLAY=:0 for the primary display
                                I would guess that the second display is :1

                                so, do
                                export DISPLAY=:1
                                then npm start

                                see if it comes up on the second display

                                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

                                  @sdetweil na, no joy. I did try this yesterday also but was not sure I was looking in the right place. For the sake of it I tried using numbers 0 to 9, all with the same result. This for example:

                                  npm ERR! code ENOENT
                                  npm ERR! syscall open
                                  npm ERR! path /home/pi/package.json
                                  npm ERR! errno -2
                                  npm ERR! enoent ENOENT: no such file or directory, open '/home/pi/package.json'
                                  npm ERR! enoent This is related to npm not being able to find a file.
                                  npm ERR! enoent 
                                  
                                  npm ERR! A complete log of this run can be found in:
                                  npm ERR!     /home/pi/.npm/_logs/2020-02-04T21_33_32_894Z-debug.log
                                  

                                  However if I reboot the RPI with run-start having the different value it will still display the MM on the first screen, this made me think that this script was not being used at the startup as I would expect it to fail and not display the MM - perhaps I am wrong.

                                  S 2 Replies Last reply Reply Quote 0
                                  • bheplerB Offline
                                    bhepler Module Developer
                                    last edited by

                                    I wonder if we’re looking in the wrong place? Perhaps it’s how the MM process is calling Electron that determines where on the desktop the app appears.

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

                                      @NathTheDude said in Rpi 4 and two monitors:

                                      npm ERR! code ENOENT
                                      npm ERR! syscall open
                                      npm ERR! path /home/pi/package.json
                                      npm ERR! errno -2

                                      you are doing npm start in the root, not in the MagicMirror folder…

                                      Sam

                                      How to add modules

                                      learning how to use browser developers window for css changes

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

                                        @bhepler that is run-start.sh

                                        ~/MagicMirror/package.json

                                        {
                                          "name": "magicmirror",
                                          "version": "2.10.1",
                                          "description": "The open source modular smart mirror platform.",
                                          "main": "js/electron.js",
                                          "scripts": {
                                            "start": "./run-start.sh",     // < ------   when u do npm start this happens
                                        

                                        Sam

                                        How to add modules

                                        learning how to use browser developers window for css changes

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

                                          @NathTheDude run-start.sh is in the MagicMirror folder

                                          actually the pm2 only on the 1st screen is understandable
                                          as the script used by pm2 is installers/mm.sh

                                          which does

                                          DISPLAY=:0 npm start
                                          

                                          and run-start does

                                          # if DISPLAY is not set then set it
                                          if [ -z "$DISPLAY" ]; then #If not set DISPLAY is SSH remote or tty
                                          	export DISPLAY=:0 # Set by default display
                                          fi
                                          

                                          so I would just set export DISPLAY=:0
                                          and the execute run-start.sh

                                          Sam

                                          How to add modules

                                          learning how to use browser developers window for css changes

                                          1 Reply Last reply Reply Quote 0
                                          • bheplerB Offline
                                            bhepler Module Developer
                                            last edited by

                                            I have to head home, so I can’t investigate any more for some time. But I did find this link on StackOverflow that seems to address the issue. Aren’t we using an X11 based desktop manager?
                                            Anyway, this may help.

                                            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
                                            • 1 / 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