Capturing screenshots on WebOS

I'm looking for a way to take screenshots either with some utility or programmatically using API. The application I'm using has that functionality (written in Java, AWT library) but it doesn't work since WebOS seem to be using Wayland, and not X11. The following error is logged:

java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.

I also considered using Xwayland in order to have X11 compatible interface, though couldn't find any related information and if capturing screenshots is possible with it.

1 Like

It seems there's no API available for this in webOS OSE (yet). It used to be in LunaSysMgr from Open webOS as per

On legacy webOS 3.0.x you could take screenshots with Home & Power button.

In LuneOS (based on Open webOS) we implemented it in our own UI.

Thanks for your response.
And what wayland compositor is used now in webOS OSE? And are there any plans to implement screenshot functionality in it?
As I understand there's no use in installing xwayland as wayland doesn't have screenshot API anyway?

I don't know whether it is helpful to you or not. but luna-surfacemanager in webOS OSE has a screenshot source.

I was able to capture screenshot with this command:

luna-send -n 1 -f luna://com.webos.surfacemanager/captureCompositorOutput '{"output":"/home/root/screenshot-temp.jpg","format":"JPG"}'

Though a problem that at the time when screenshot was taken a video was playing on the screen, screenshot is always a black picture. On other content it works.


Thank you for the luna-send command. It works on WebOSE 1.0 build for raspbery3.

Unfortunately the build for raspbery4, I got in
returns "errorText": "com.webos.surfacemanager is not running.".
I'll be very grateful if someone let me now how to get capturescreen?

I got the picture
The reason was If monitor is not connected there will be "errorText": "com.webos.surfacemanager is not running.".