I recently began a slow migration from using a 2014 Macbook Pro to a new 2019 Dell XPS 13. There’s probably another post there but basically, overdue a replacement, didn’t fancy the new keyboards and wanted to switch back to using Linux 100% of the time. Of course Apple then announced new keyboards on their latest model. D’oh! But I’m happy with the XPS so far, running Ubuntu. I also wanted to switch to a tiling window manager, and chose Sway (I wanted to run Wayland) as I had some experience with i3. It’s taken some time but I’m getting used to it - can’t recommend it enough. That was, until I needed to take a screenshot when amending some client documentation. Google searches on how to do this were a bit sparse, so for anyone else’s benefit the answer is to install the packages Grim and Slurp. Grim is a utility for taking screenshots from a Wayland compositor, while slurp is a utilty for selecting a region; they can be combined in a small script as follows:

FILENAME="screenshot-`date +%F-%T`"
grim -g "$(slurp)" ~/Downloads/$FILENAME.png

Naming this screenshot.sh or somesuch and dropping it into a directory on your $PATH means you can easily select it via dmenu and quickly have a screenshot in your Downloads directory. Works a treat.