Skip to content
yutadev31Public

About

A fast, cross-platform screenshot CLI

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

41 Commits

Folders and files

Repository files navigation

shot

A lightweight, cross-platform screenshot utility written in Rust.

shot captures screenshots and writes PNG or JPEG images to standard output, making it easy to save screenshots to files or pipe them into other commands.

Features

  • Capture a single monitor or all monitors.
  • Select a monitor by index or name.
  • Combine multiple monitors into one image while preserving their desktop positions.
  • Output PNG or JPEG images directly to standard output.
  • Support X11, Wayland, and Windows.

Installation

Cargo

cargo install --git https://github.com/yutadev31/shot

Nix

nix profile install github:yutadev31/shot

Usage

Capture all monitors

shot > screenshot.png

When multiple monitors are connected, their screenshots are combined into a single image.

Select the output format

PNG is the default. Select JPEG with --format jpeg:

shot --format jpeg > screenshot.jpg

--format png explicitly selects PNG. Both formats support monitor and region captures.

Capture a specific monitor

Select a monitor by its zero-based index:

shot --monitor 0 > screenshot.png

Or select it by name:

shot --monitor HDMI-A-1 > screenshot.png

The short option -m is also available.

Capture a region

Use desktop coordinates in X,Y WIDTHxHEIGHT format (negative coordinates are supported):

shot --region "100,200 640x480" > screenshot.png
shot -r $(slurp) > screenshot.png

Quoted slurp output (shot -r "$(slurp)") is also supported. The region must fit within the desktop image. --region cannot be combined with --monitor.

On Wayland, region coordinates use the compositor's logical desktop geometry and require the xdg-output protocol. Each output is cropped at its own buffer scale; images spanning different scales use the largest selected scale.

Copy a screenshot to the clipboard

Use cpst to copy a screenshot directly to the system clipboard:

shot | cpy

Save and copy simultaneously

shot | tee screenshot.png | cpy

Note: shot does not write image data directly to a terminal. Redirect or pipe its standard output.

Platform Support

Platform Backend Status
Linux Wayland Supported
Linux X11 Supported
Windows Win32 Supported
macOS — Not supported

On Wayland, the compositor must support at least one of the following screenshot protocols:

  • ext-image-copy-capture-v1
  • wlr-screencopy-unstable-v1

On Windows, version 1703 or later of Windows 10 is required. Use Command Prompt or PowerShell 7.4 or later when redirecting PNG output.

Screenshot capture requires an active graphical desktop session.

Development

Enter the Nix development environment:

nix develop

Run checks with Cargo:

cargo fmt --all --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test

Build the release binary:

cargo build --release

License

Licensed under the MIT License.

About

A fast, cross-platform screenshot CLI

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages