Read the statement by Michael Teeuw here.
Multiple screens fo MM.
-
@Joshrobbs1 said in Multiple screens fo MM.:
My idea is to run two monitors vertical on each side.
I like the idea a lot. Please keep us posted. i am curious as to whether you experience any performance issues.
-
@Joshrobbs1 Two monitors on each side, or one each/two total? You could run two completely separate mirror instances, or one instance (i.e. server) and hide the modules (via CSS) you don’t want displayed on each one.
I suggest using a Raspberry Pi Zero W to power one display, run a browser and connect to the other instance/server (or run an MM instance on the RPi Zero W). The server could be on a more powerful Raspberry Pi (3b) or some old laptop hardware. You would want to run the simpler, static modules (weather, time, calendar) on the RPi Zero W and the more demanding, processor-intensive modules (voice, video feeds, complex rendering) on the server.
I don’t know how MM feels about running two instances on the same machine – you’d need to set different ports, scripts, etc, but I imagine it’s possible with some reconfiguration to avoid collisions.
-
@ninjabreadman Hi,
Now we have a rpi4B with 2 screens available, and i want to display on 2 screens the magic mirror.
is it possible with the version 2.20 ?
-
@hogedir With a raspberry 4 you can have two displays. I’m thinking they can be set up as an extended desktop . Then it’s no big deal with the default magic mirror.
Top_left and top_right would end up being left and right…
I haven’t tried this with MM. But I have used my pi with two screens. But in my mind it ought to work with MM.
Just don’t use the middle_center or any position that would span across both monitors. -
@kayakbabe I think we need two electron display, so it’s not quite easy. it’s not just top_left and top_right. I need 2 MMM, 1 magic mirror per screen.
-
@hogedir electron (and other browsers) runs maximized, which is only one screen…
you can DRAG the edge to make the window larger, but cannot maximize over two screens…
you can run separate instances of MM on each display…
-
@hogedir I had two running off one display, just two different Magicmirror installs. I forgot how it works though, was using them as a temporary menu display.
Something about calling different config files if I recall right.
-
@BKeyport MM_CONFIG environment variable
allows the different configs off the same directory tree
-
@BKeyport this answer inspired me to test it, so I have a solution:
- create two different folders.
- configure each install as you like.
- edit each electron file in each folder “js/electron.js”
- change the default resolution and position based on your screens.
here is my config:
let electronOptionsDefaults = { width: 1280, height: 1024, x: 1366, y: 0, }NOTE: there are many better methods (electron-multi-monitor for example) but this is the easiest that I could find
-
@karam u can set the electronOptions in config.js, you don’t need to edit the source file
then you can do it with one folder,
and two config filesenvironment variable
MM_CONFIG=config1.js
for oneand
MM_CONFIG=config2.js
for the otherall modules for both are installed in modules folder, only ones referenced in config file are used
installers/mm.sh is the script used by my pm2 setup routine
copy that to mm2.sh
and then add the export MM_CONFIG=
to eachthen copy the pm2_magicmirror.json
and change the title and the mm.sh filenamethen pm2 start installers/??? (whatever name u copied the json file to for the second mm)
pm2 save
then on reboot you will get both -
@sdetweil: can you please share an example? I am not sure how to indicate the secondary display in the config files. Thank you!
-
@cburchett it’s one big display, so you have to tell it how far from the left edge to start this display.
see
https://forum.magicmirror.builders/topic/6623/multiple-screens-fo-mm/18?_=1666468889775only need x for horizontal monitors
or y for vertical -
S sdetweil referenced this topic on
-
@sdetweil Perfect! Thank you.
-
@sdetweil said in Multiple screens fo MM.:
MM_CONFIG=config1.js
Can you please elaborate, a little bit more? I’m trying this, but not understood well.
Thank You. -
@Sagar73594 if you have a bash or sh script, you can set environment variables that the MM code will read
export MM_CONFIG=??? filename
will cause filename to be used as the name of the file to read for configuration (replacing config.js)
if you use my install script and selected use pm2, then the script is
~/MagicMirror/installers/mm.shbefore the line
npm start
add the line above to set the file nameso, by using different config files, one could launch multiple instances of MagicMirror from the same set of files.
some could target one display and others another, and some could be server only as weill.one could also install 50 modules and use the same 25 in all instances and some mix of the others in different instances, all from the same set of files in the MagicMirror folder tree.
-
@sdetweil said in Multiple screens fo MM.:
@Sagar73594 if you have a bash or sh script, you can set environment variables that the MM code will read
export MM_CONFIG=??? filename
will cause filename to be used as the name of the file to read for configuration (replacing config.js)
if you use my install script and selected use pm2, then the script is
~/MagicMirror/installers/mm.shbefore the line
npm start
add the line above to set the file nameso, by using different config files, one could launch multiple instances of MagicMirror from the same set of files.
some could target one display and others another, and some could be server only as weill.one could also install 50 modules and use the same 25 in all instances and some mix of the others in different instances, all from the same set of files in the MagicMirror folder tree.
-
@sdetweil said in Multiple screens fo MM.:
@Sagar73594 if you have a bash or sh script, you can set environment variables that the MM code will read
export MM_CONFIG=??? filename
will cause filename to be used as the name of the file to read for configuration (replacing config.js)
if you use my install script and selected use pm2, then the script is
~/MagicMirror/installers/mm.shbefore the line
npm start
add the line above to set the file nameso, by using different config files, one could launch multiple instances of MagicMirror from the same set of files.
some could target one display and others another, and some could be server only as weill.one could also install 50 modules and use the same 25 in all instances and some mix of the others in different instances, all from the same set of files in the MagicMirror folder tree.
Hi Sagar,
Hello Sagar, thank you for your guidance. Unfortunately, I keep encountering an error upon startup. A version starts automatically with the familiar error message “npm run config: check”. I stop the MagicMirror and manually start it from the MagicMirror folder with npm start, but then it allegedly cannot find the config. As you described, I created config1 and config2, then edited installers/mm.sh and mm2.sh. It looks something like this now:
cd ~/MagicMirror
export MM_CONFIG=config2.js
DISPLAY=:2 npm startI also copied the pm2_MagicMirros.json once and simply appended a “1” to the name. The configuration looks like this:
“apps” : [{
“name” : “MagicMirror”,
“script” : “/home/pi/MagicMirror/installers/mm.sh”,
“watch” : [“/home/pi/MagicMirror/config/config1.js”]Do you perhaps have any tips for me on what I might be doing wrong?
-
@chichi1887 well, you need two pm2_MagcMirror.json, right? and each points to a different mm.sh, right?
original
pm2_MagicMirror.json"apps" : [{ "name" : "MM_Screen1", "script" : "/home/pi/MagicMirror/installers/mm.sh", "watch" : ["/home/pi/MagicMirror/config/config.js"]new pm2_MagicMirror2.json
"apps" : [{ "name" : "MM_Screen2", "script" : "/home/pi/MagicMirror/installers/mm2.sh", "watch" : ["/home/pi/MagicMirror/config/config2.js"]then
pm2 start each json
and then pm2 saveto test before pm2 start , you can
cd ~/MagicMirror installers/mm2.shor
cd ~/MagicMirror installers/mm.shto start them both, open another terminal window or ssh session, starting one in each
ctrl-c in the term window will end that instance
-
@sdetweil said in Multiple screens fo MM.:
cd ~/MagicMirror
installers/mm2.shHey,
the mm.sh starts without a problem but the second has this

all modules that starts on the mm.sh are disable in the mm2 config.
Display=0 in both are correkt or the second must be nr.1? -
When I start the mm2.sh script, despite the correct configuration, it takes the config.js instead of the config2.js. Therefore, it seems unable to start both instances simultaneously because it attempts to open the same config.js. The configuration looks like this in the mm2.sh script:
cd ~/MagicMirror
export MM_CONFIG=config2.js
DISPLAY=:0 npm startthe pm2_MagicMirror2.json is copy and paste from u ;-)
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