Read the statement by Michael Teeuw here.
Multiple screens fo MM.
-
@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 -
-
@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?