https://github.com/emersion/grim
Grab images from a Wayland compositor
https://github.com/emersion/grim
cli screenshot scrot wayland
Last synced: about 1 month ago
JSON representation
Grab images from a Wayland compositor
- Host: GitHub
- URL: https://github.com/emersion/grim
- Owner: emersion
- License: mit
- Archived: true
- Created: 2018-05-04T12:59:52.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-03-30T08:20:08.000Z (about 3 years ago)
- Last Synced: 2025-03-15T01:43:25.587Z (about 1 month ago)
- Topics: cli, screenshot, scrot, wayland
- Language: C
- Homepage: https://wayland.emersion.fr/grim
- Size: 205 KB
- Stars: 935
- Watchers: 17
- Forks: 37
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starred - grim - Grab images from a Wayland compositor (C)
README
# grim
> ⚠️ **Heads up!** This project has [moved to SourceHut](https://sr.ht/~emersion/grim/).
Grab images from a Wayland compositor. Works great with [slurp] and with [sway].
## Example usage
Screenshoot all outputs:
```sh
grim
```Screenshoot a specific output:
```sh
grim -o DP-1
```Screenshoot a region:
```sh
grim -g "10,20 300x400"
```Select a region and screenshoot it:
```sh
grim -g "$(slurp)"
```Use a custom filename:
```sh
grim $(xdg-user-dir PICTURES)/$(date +'%s_grim.png')
```Screenshoot and copy to clipboard:
```sh
grim - | wl-copy
```Grab a screenshot from the focused monitor under Sway, using `swaymsg` and
`jq`:```sh
grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name')
```Grab a screenshot from the focused window under Sway, using `swaymsg` and
`jq`:```sh
grim -g "$(swaymsg -t get_tree | jq -j '.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"')"
```Pick a color, using ImageMagick:
```sh
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:
```sh
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][github] or [send patches on the mailing
list][ml].Join the IRC channel: #emersion on Libera Chat.
## License
MIT
[slurp]: https://github.com/emersion/slurp
[sway]: https://github.com/swaywm/sway
[github]: https://github.com/emersion/grim
[ml]: https://lists.sr.ht/%7Eemersion/public-inbox