Last edited 2 weeks ago

How to make a screen capture in Weston

Applicable for STM32MP13x lines  STM32MP15x lines    STM32MP23x lines  STM32MP25x lines


Note: a screen capture is also referred to as a snapshot or screenshot. These words all mean the same thing.

1. Screen capture with a command line

The Weston debug tool weston-screenshooter is used to take screen captures in PNG format. This tool can be used only with Wayland Weston configured in debug mode. To enable the Weston debug mode, add the following line to the file named /etc/default/weston:

OPTARGS=--debug
# if OPTARGS variable was already there, append "--debug" to it, for instance
# OPTARGS=--something
# becomes
# OPTARGS=--something --debug

The Weston debug mode is taken into account after a stop/start of the Wayland Weston service (refer to the article on How to stop and start Weston).

With the Weston debug mode now enabled, you can take a screen capture using the following command:

weston-screenshooter


The captured picture, in PNG format, is named wayland-screenshot-YYYY-MM-DD_hh-mm-ss.png and stored in /home/weston, /home/root, or /, depending on your Weston configuration.

ls /home/$USER # where $USER could be 'weston', 'root', ...
 typescript  wayland-1  wayland-1.lock  wayland-screenshot-2023-10-11_19-55-31.png  weston-previous.log  weston.log

You can copy the screenshot from the board to the host PC in the <file-path> directory (for example, using the scp command):

scp root@<ip address>:/home/weston/wayland-screenshot-*.png <file-path>/

2. Screen capture with a keyboard

Refer to Weston keyboard shortcut for screenshot capture to find out how to take screen captures with Weston using keyboard shortcuts.