How to make a screen capture in Weston

Revision as of 17:47, 16 November 2023 by Registered User
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Applicable for STM32MP13x lines, STM32MP15x 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[edit source]

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
Warning white.png Warning
If Weston is configured with a "weston" user instead of a "root" user, use the following commands:
 su -l "weston" -c "weston-screenshooter"

Note: Above tips may not be necessary on Yocto Project® versions greater than or equal to 4.2 ("Mickledore").

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/weston
 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[edit source]

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