$ doas pkg_add maim
Install maim
:
$ doas pkg_add maim
Create a script with the following content and save it to ~/bin/screenshot
(assuming ~/bin
is in the user’s PATH
):
#!/bin/sh
maim -s | xclip -selection clipboard -t image/png
All this script does is invoking maim
to prompt the user to select the region
of the screen he wants to take a screenshot of, upon which maim
will create a
PNG image of the region, which is then copied to the clipboard.
Make the script executable:
$ cd ~/bin
$ chmod u+x screenshot
Define a keybinding in ~/.cwmrc
for invoking screenshot
via the key
combination Alt + s
(of course, any other combination works as well):
bind-key M-s "bin/screenshot"
Define an alias in ~/.kshrc
for pasting the image from the clipboard to a
file:
alias clip2file='xclip -selection clipboard -o >'
That’s it.
Then, to take a screenshot, do the following:
Press Alt + s
.
Select the region of the screen you want to take a screenshot of.
Go to a terminal and type:
$ clip2file <file>.png
The resulting screenshot will be saved to <file>.png
.
Another script for taking screenshots by Roman Zolotarev.
Another script for taking screenshots by Solène Rapenne.