Taking a screenshot of a menu in Cinnamon (Linux)

The normal method of taking a screenshot in Linux (in Cinnamon, at least) does not work while selecting a menu command is in progress. Example from selecting menu “Sheet”“Fill Cells”“Fill Series” in LibreOffice:

All keyboard input, including the key combinations for taking screenshots and Alt + Tab to switch to another application, are completely blocked while menus are open.

Solution

A solution is to delay the screenshot a number of seconds, giving enough time to select the menu command. ImageMagick’s ‘import’ command, which is installed by default on Ubuntu MATE 20.04 (Focal Fossa), is one such program that can do this.

Synthesising the required options from the documentation is non-trivial (for instance, “-delay” does not do anywhere near what is expected and “-pause” needs to be combined with “-window” (see below)), but the solution is:

import -pause 10 -window root  someScreenshotWithAMenu2.png

The result is in file someScreenshotWithAMenu2.png and can further be manipulated in e.g. Krita (as this will capture the entire screen – both screens if on a two-monitor system).

Note: Without “-window root” the error message is “import-im6.q16: unable to grab mouse `’: No such file or directory @ error/xwindow.c/XSelectWindow/9187.” and nothing is saved.

Alternatives

The built-in application “Screenshot” in Debian/Ubuntu/Ubuntu MATE 20.04 (Focal Fossa) (Win + “screen” → “Screenshot”) can also delay the screenshot for a number of seconds. The option is “Grab after a delay of”.

Leave a Reply

Your email address will not be published. Required fields are marked *

*