grim
Take screenshots of your desktop
TLDR
Screenshot all outputs
Screenshot a specific output
Screenshot a specific region
Select a specific region and screenshot it, (using slurp)
Use a custom filename
Screenshot and copy to clipboard
SYNOPSIS
grim [OPTIONS] [FILE]
If FILE is omitted, grim will write to standard output.
PARAMETERS
-g <geometry>
Grab a specific region of the screen. The geometry string is typically in the format 'WxH+X+Y' (width, height, x-offset, y-offset) or can be provided by slurp.
-o <output>
Specify the output name (e.g., 'DP-1', 'eDP-1') to capture a screenshot from a specific monitor. Use grim -l to list available outputs.
-s <factor>
Apply a scaling factor to the captured image. Useful for HiDPI displays.
-t <format>
Specify the output image format. Supported formats include png (default), jpeg, and webp.
-q <quality>
Set the compression quality for jpeg and webp formats. Value ranges from 0 to 100.
-l
List available Wayland outputs (monitors) and their current configurations.
-h
Show help message and exit.
-v
Show version information and exit.
DESCRIPTION
grim is a command-line utility for taking screenshots on Wayland compositors. It is part of the wlroots project, which provides a composable Wayland compositor library.
Unlike traditional X11 screenshot tools, grim interacts directly with the Wayland compositor via the xdg-desktop-portal and wlr-screencopy protocols, ensuring native Wayland compatibility and security.
grim adheres to the Unix philosophy, focusing solely on capturing pixel data from the screen. It does not provide any graphical user interface for region selection or image manipulation. For selecting a specific region, it is commonly used in conjunction with tools like slurp. For copying the screenshot to the clipboard, tools like wl-copy are employed. This modular approach allows users to combine grim with their preferred utilities for a customized screenshot workflow.
CAVEATS
grim is designed exclusively for Wayland compositors and will not function on Xorg-based desktop environments. It relies on specific Wayland protocols (wlr-screencopy and xdg-desktop-portal) that must be supported by your compositor. It lacks built-in features for region selection or clipboard integration, requiring external tools for these functionalities.
USAGE EXAMPLES
Here are common ways to use grim:
Full screenshot to file:grim ~/screenshot_$(date +%Y%m%d_%H%M%S).png
Captures the entire screen and saves it with a timestamped filename.
Region screenshot to file:grim -g "$(slurp)" ~/region_shot.png
Uses slurp to interactively select a region, then captures and saves it.
Full screenshot to clipboard:grim - | wl-copy
Captures the entire screen and pipes the image data directly to wl-copy to put it on the Wayland clipboard.
Region screenshot to clipboard:grim -g "$(slurp)" - | wl-copy
Selects a region, captures it, and copies it to the clipboard.
Screenshot a specific monitor:grim -o DP-1 ~/monitor_screenshot.png
Captures only the content of the monitor named 'DP-1'.
HISTORY
grim was developed as a crucial part of the wlroots ecosystem, primarily by contributors associated with the swaywm project. Its creation addressed the need for a robust and secure screenshot utility on Wayland, where traditional X11 tools like scrot or gnome-screenshot are not compatible. Its development reflects the Wayland philosophy of security, simplicity, and reliance on compositors for screen access, leading to its design as a single-purpose tool that integrates well with other command-line utilities.