+++ title = "Taking screenshots on Wayland with Grim and Slurp" date = 2024-01-18 draft = false [taxonomies] categories = ["Linux"] [extra] author = "Emil Miler" +++ I have done some experimenting with [dwl](https://codeberg.org/dwl/dwl) and [river](https://isaacfreund.com/software/river/) on Wayland, which requires a change of my X11 setup. This article quickly explains how to replace the old [Shotgun and Slop](@/posts/taking-screenshots-with-shotgun-and-slop/index.md) for a simple Wayland alternative. This replacement is very similar to the original combo. What you need is `grim` for screenshots, `slurp` for area selection and `wl-clipboard` for clipboard features: ```sh grim -g "$(slurp -d)" - | tee /home/$USER/scrot/$(date +'%F_%T').png | wl-copy ``` The `-d` option in `slurp` just shows us the selection dimensions, which is a neat feature. We can also implement a simple color picker, which will grab selected pixel color and copy a hex color output to the clipboard: ```sh grim -g "$(slurp -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:- | grep -o '#[0-9A-F]\{6\}' | tr -d '\n' | wl-copy ``` More interesting ways of using Grim can be found at [Grim examples](https://sr.ht/~emersion/grim/#example-usage).