๐Ÿ Home๐Ÿ“šBlogs
๐Ÿ“Post

Taking screenshots ๐Ÿ“ธ in GNU/Linux systems like a pro using maim and sxhkd

โŒ› a year ago | ๐Ÿ“– 1 min read


What are we trying to do?

Here we are trying to create our own screenshot workflow in our linux system using minimal FOSS tools like maim, xclip and sxhkd. This is useful for minimal systems that use window managers instead of desktop environments. Although it should work fine on desktop environments also.

Requirements

Above mentioned tools are available in package managers of popular linux distros like ubuntu, arch, debian and their derivatives. Also there is an option of building from source code in Github repos.

Steps

  1. Get all the required programs installed in your system.
  2. Add these lines to your sxhkdrc file usually located at ~/.config/sxhkd/sxhkdrc
Print maim --select | xclip -selection clipboard -t image/png shift + Print maim --select >> ~/Pictures/$(date +%s).png

Now, after restarting the sxhkd process you should be able to take screenshot using Print Screen key in your keyboard. Which will prompt you for area grab and then capture your selected area. Now, the picture is available in your clipboard.

Also, you can use combination of Shift + Print Screen to capture an area and save it in ~/Pictures/ directory with name as current date and timestamp.

Please make sure there are no processes listening to Print Screen and Shift + Print Screen other than sxhkd. Also make sure that directory ~/Pictures/ exists. You may need to create one if it does not already exist.

Wrapping up ๐ŸŽ

Now you have built your own screen capture workflow using simple and minimal tools like maim, sxhkd and xclip.


Share this on

Related Blogs;