Can't open image fullscreen from node-red

Hi,

I have Node-RED running on ubuntu dekstop locally and i want show a picture in fullscreen from a node-RED trigger, i thought that would be possible from the exec node but got these error

`Command failed:  bash /home/mediacenter/.node-red/scripts/2.sh
Unable to init server: Could not connect: Connection refused

(eog:4320): Gtk-WARNING **: 19:32:36.916: cannot open display: `

when i run the command in the terminal is works as expected. Why does i not work from Node-RED?

This is my flow

[{"id":"a2d7b281.33cbe","type":"exec","z":"7f48333a.ec0c9c","command":"","addpay":true,"append":"","useSpawn":"false","timer":"60","oldrc":false,"name":"","x":410,"y":140,"wires":[[],[],["372535d6.3e8fda"]]}]

and this in the 2.sh file

#!/bin/bash

eog --fullscreen /home/mediacenter/media/instructions/1.gif

Welcome to the forum @coen17st.

Does it help if you use something like
bash -c "DISPLAY=:0 /home/mediacenter/.node-red/scripts/2.sh"

If that does work there may well be a better way of writing it.

Thanks so much @Colin that works.
I'm going to look up exactly what -c "DISPLAY=:0 means and why it's needed in Node-RED and not locally in ubuntu

It is needed because you are running node red in a session that does not have a display associated with it. You would have the same issue if you tried to run the command from any application running in the background. For example if you used ssh to open a terminal on the node-red machine from another PC and ran the command from there.

1 Like

Thanks a lot, i understand now

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.