Take screenshot and copy it to the system clipboard.
This is a small program that shells out to imagemagick to take a screenshot, and then uses GTK to copy it to the system clipboard.
screenshot-to-clipboard
This program provides a simple way to take a screenshot and copy it to your system clipboard.
When you run screenshot-to-clipboard, it internally runs the import program from ImageMagick to take a screenshot, and then uses GTK to copy that screenshot to your system clipboard.
Installation
The recommended installation procedure is to use Nix. With Nix installed, just do:
$ git clone [email protected]:cdepillabout/screenshot-to-clipboard
$ cd screenshot-to-clipboard/
$ nix-build
You can run this program with the output result/bin/screenshot-to-clipboard program.
screenshot-to-clipboard is also available in Nixpkgs, starting with NixOS-22.11 as haskellPackages.screenshot-to-clipboard.
It is also possible to build with cabal (or stack), but you are responsible for installing necessary system libraries. You'll likely need both imagemagick, and the development packages for GTK.
Usage
If you run screenshot-to-clipboard, it will turn your cursor into a cross-hair. Click and drag to select a portion of the screen to take a screenshot. This screenshot will be copied to your system clipboard. You can paste it into another application.
screenshot-to-clipboard will continue running until you've copied something else into your system clipboard. See the long comment in src/ScreenshotToClipboard.hs for why this is necessary.