Rotating display on Intel NUC?


Has anyone been able to successfully rotate the display and/or touchscreen with an Intel NUC running resin? Normally setting the rotation in xorg.conf would work but the intel drivers don’t seem to like it. Running xrandr -o right via ssh kinda works but Im unable to access the DISPLAY inside my script or Dockerfile so I havent been able to run that on start. Thoughts?

Base: resin/nuc-node:6.9

Rotate display on Intel NUC

Hi @danielmahon, have you tried just setting DISPLAY=:0? That usually just works whenever you run X in these cases. So maybe just do:

DISPLAY=:0 xrandr -o right

Haven’t tried this so it’s just a guess.


If that does the trick you can always export DISPLAY=:0 at the start of your script so any other commands related to X will get the right display.

@danielmahon, where are you trying to access $DISPLAY? I would not expect it to be set in the Dockerfile (as that will run on the builder rather than on the device) so if you are trying to access it there it will likely fail.


So I was working on this with @craig earlier and this is where I left it… for now:

FROM resin/nuc-node:6.9
CMD ["bash", "/usr/src/app/"]

ENV DISPLAY :0 in Dockerfile and export DISPLAY=:0 in both correctly make the DISPLAY variable available. The problem is when running something like:

# Rotate display and touchscreen
xrandr -o right
xinput set-prop "ELAN Touchscreen" --type=float "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
# Start application
startx /usr/src/app/node_modules/electron/dist/electron /usr/src/app --enable-logging

in, xrandr returns a “Cannot open display at :0” error. This works fine when I ssh into the device, with one caveat that the display rotates but the resolution/window size doesnt seem to adjust properly, cutting off half the screen. That made me think that there might be a problem trying to run xrandr before running startx (not sure why). So I moved the xrandr and xinput commands to a child process spawned by Electron’s main.js and it works great. Both the display and touchscreen rotate and fill the monitor properly.

So right now this way works fine but I’m still not sure why my scripts cannot OPEN the display.


Yeah, xrandr communicates with the running X process, so I don’t think it will behave correctly (or maybe not function at all?) if X is not running. That would explain why it can’t open the display in your script – the display just isn’t there yet.

If you move those lines to after your startx command they should work. You might want to add a sleep in there just to give X time to start up before you do it, e.g.

# Start application
startx /usr/src/app/node_modules/electron/dist/electron /usr/src/app --enable-logging
# Wait for X to come up
sleep 3
# Rotate display and touchscreen
xrandr -o right
xinput set-prop "ELAN Touchscreen" --type=float "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1

You can also configure a bunch of this stuff in a file that will be loaded when X starts so you don’t have the delay there in xorg.conf:

Get Touchscreen eGalaxy Touch working
Get Touchscreen eGalaxy Touch working

hey @danielmahon, just wondering whether these notes above have helped, and things work for you now?


They did help. Needed to rotate display AFTER the window session had started. Makes sense. :grin:


For anyone trying to make this work, we released a project/blog post showing how to run a x11 desktop manager on a Raspberry Pi or other devices.

You can check it here: