Read the statement by Michael Teeuw here.
Rpi 4 and two monitors
-
@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.shwhich does
DISPLAY=:0 npm startand 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 fiso I would just set export DISPLAY=:0
and the execute run-start.sh -
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. -
@bhepler correct, that is DISPLAY
-
thanks @sdetweil , right you are - I was not running npm from within the MagicMirror directory.
When I update ‘Display’ to 1 I still get an error when trying to manually run NPM, however when ‘Display’ is set to 0 and then I run NPM there are no errors with it. The error is:
pi@MagicMirrors:~/MagicMirror $ npm start > magicmirror@2.10.1 start /home/pi/MagicMirror > ./run-start.sh (electron:11918): Gtk-WARNING **: 22:18:00.088: cannot open display: :1 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! magicmirror@2.10.1 start: `./run-start.sh` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the magicmirror@2.10.1 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /home/pi/.npm/_logs/2020-02-04T22_18_00_154Z-debug.log pi@MagicMirrors:~/MagicMirror $@bhepler thanks for the link, it is a bit beyond my understanding at the moment. I will have to read up on it a bit more. I tried to run xrandr to see what kind of status it gives on the monitors but it currently comes back with ‘Can’t open display’, I assume it is because another service/application is utilising them?
Anyway, thanks for your help.
-
@NathTheDude said in Rpi 4 and two monitors:
When I update ‘Display’ to 1 I still get an error
Yes, we just need to find out what the other Display number is.
tvservice is wrong cause it reports display 2 for HDMI 0, and we know it’s really Display 0
-
@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? :)
-
@NathTheDude The 2nd monitor should be display 0, screen 1. Use this:
DISPLAY=:0.1 -
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 startWhich 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.
-
@NathTheDude If you start a terminal on one desktop and run:
echo $DISPLAYThen start a terminal on the other desktop and run:
echo $DISPLAYdo you get the same results?
-
@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 :-/
-
@OldSunGuy , sorry mis read your comment. Not sure how I would start a terminal on one screen and a different terminal on another.
-
@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…
-
@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.
-
@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?
-
@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.
-
@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).
-
@NathTheDude there is a firmware update on the pi4… execute
sudo rpi-update -
@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.
-
@NathTheDude how about the output of xrandr -q
-
@sdetweil . I get the following when trying to run different xrandr commands:
Can't open display
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