0
Fork 0
mirror of https://github.com/emersion/grim.git synced 2026-10-20 19:10:05 +00:00
Grab images from a Wayland compositor https://wayland.emersion.fr/grim
  • C 88.4%
  • Meson 8.6%
  • Shell 3%
Find a file
History 2022-03-30 10:20:08 +02:00
contrib/completions bash-completion: localize variables 2022-03-27 16:37:23 +02:00
include Stop using cairo_surface_t 2022-01-20 11:19:49 +01:00
protocol build: bump to Meson 0.58.0 2022-02-09 00:09:48 +01:00
.build.yml Remove cairo dependency 2022-01-20 11:19:49 +01:00
.editorconfig Add .editorconfig 2018-05-13 21:38:37 +01:00
.gitignore First commit 2018-05-11 22:26:31 +01:00
box.c Only screenshot outputs we're interested in 2018-05-18 08:54:33 +01:00
buffer.c Use shm_open instead of XDG_RUNTIME_DIR 2018-11-14 18:38:33 +01:00
grim.1.scd Allow setting compression level for PNG output 2021-10-08 14:12:45 +02:00
LICENSE Initial commit 2018-05-04 13:59:53 +01:00
main.c Stop using cairo_surface_t 2022-01-20 11:19:49 +01:00
meson.build build: bump to version 1.4.0 2022-02-09 00:20:30 +01:00
meson_options.txt add bash completion 2021-08-13 14:54:40 +02:00
output-layout.c Split rendering and output layout functions in separate files 2018-05-18 09:16:59 +01:00
README.md readme: move to sr.ht 2022-03-30 10:20:08 +02:00
render.c Stop using cairo_surface_t 2022-01-20 11:19:49 +01:00
write_jpg.c write_jpg: fix printf format specifier 2022-02-08 20:11:10 -05:00
write_png.c write_png: switch from cairo_surface_t to pixman_image_t 2022-01-20 11:19:49 +01:00
write_ppm.c write_ppm: switch from cairo_surface_t to pixman_image_t 2022-01-20 11:19:49 +01:00

grim

⚠️ Heads up! This project has moved to SourceHut.

Grab images from a Wayland compositor. Works great with slurp and with sway.

Example usage

Screenshoot all outputs:

grim

Screenshoot a specific output:

grim -o DP-1

Screenshoot a region:

grim -g "10,20 300x400"

Select a region and screenshoot it:

grim -g "$(slurp)"

Use a custom filename:

grim $(xdg-user-dir PICTURES)/$(date +'%s_grim.png')

Screenshoot and copy to clipboard:

grim - | wl-copy

Grab a screenshot from the focused monitor under Sway, using swaymsg and jq:

grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name')

Grab a screenshot from the focused window under Sway, using swaymsg and jq:

grim -g "$(swaymsg -t get_tree | jq -j '.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"')"

Pick a color, using ImageMagick:

grim -g "$(slurp -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:-

Building from source

Install dependencies:

  • meson
  • wayland
  • pixman
  • libpng
  • libjpeg (optional)

Then run:

meson build
ninja -C build

To run directly, use build/grim, or if you would like to do a system installation (in /usr/local by default), run ninja -C build install.

Contributing

Either send GitHub pull requests or send patches on the mailing list.

Join the IRC channel: #emersion on Libera Chat.

License

MIT