+++
title = "Taking screenshots with shotgun and slop"
date = 2022-03-10
draft = false

[taxonomies]
categories = ["Linux"]

[extra]
author = "Emil Miler"
+++

I have been having problems with *scrot* and its `-c` option for selecting a part of the screen. It glitched most of the time and rendered selection borders in the screenshot itself. I have decided to switch to something new -- [shotgun](https://github.com/neXromancers/shotgun).

<!-- more -->

There were basically two options, shotgun and [maim](https://github.com/naelstrof/maim), though shotgun seemed as a lighter and more simple alternative. It does not support many features which need to be substituted by other programs -- the unix way of doing things.

Several programs are needed: obviously shotgun, slop, tee and xclip.

```sh
shotgun $(slop -f '-i %i -g %g') - | tee /home/$USER/scrot/$(date +'%F_%T').png | xclip -t 'image/png' -selection c
```

This is my final command and works as follows. First thing that runs is `slop -f '-i %i -g %g'`, which returns the selection position and size. This gets passed to `shotgun` and is passed to `tee`. The file gets saved to my screenshot folder with the filename containing date and time generated by `date +'%F_%T'`. The binary data is also passed to xclip and copied to clipboard for quick pasting.
