Issue Running GUI Exec Binding Command

Tags: #<Tag:0x00007f617276c890>


I’m trying to make openHAB show the openHAB log, via MultiTail (the colorful one that shows both the events.log and openhab.log) on the screen of the server/machine running openHAB.

I have successfully made a shell script as well as an xfce desktop launcher file that both successfully open a new terminal window and show the MultiTail log. My script to accomplish this is:

xdotool key Escape && sleep 1 && xfce4-terminal --maximize && sleep 1 && xdotool type 'openhablog' && sleep .5 && xdotool key 'Return' && sleep .5 && xdotool key ctrl+minus

The above script wakes up the screen, opens a maximized new terminal window, runs the “openhablog” command to launch MultiTail and then zooms out once so I can properly see the text on my screen.

I have set the proper permissions, etc. to make the Exec Binding properly run the script, and it does.
However, I receive an error, I’m guessing because the Exec Binding doesn’t allow for GUI/X-session or whatever it’s called applications to run (hoping this isn’t the case).

Here is my error:
[INFO ] [e.smarthome.model.script.openHAB log] - Error: Can’t open display: (null)
Failed creating new xdo instance

I have used a third-party tool (TriggerCMD) in the past, but I don’t like using it and would like to accomplish my task directly using openHAB and the Exec Binding.

How can I make this work? Thank you!!

Commands run in the exec binding do not have a shell, hence no display. Some people call a shell script using the exec binding. I do not know if that would work in this situation.


For X programs to run on the right display a variable called DISPLAY needs to be set.
Some information is given here.
As multiple users can share a computer with different displays a security token is used to only allow the owner of the DISPLAY connect to it ( ).
You can try to either disable the security by using xhost+ in the environment of the target display or try to run your command via a ssh tunnel ( connect from openhab user to the user that owns the display ).


1 Like

Actually they need a shell to set the display, hence my suggestion of using a shell script.

Those discussions are well outside the topic of this thread though. They are more appropriate in a Linux or UNIX forum. Yes, I was a UNIX Administrator for many years.

1 Like