This is the procedure for setting up ImageMagick to take screenshots in GNOME on FreeBSD. The filename will be named in the ISO 8601 format.
Why use ImageMagick instead of default GNOME for taking screenshots?
The default screenshot feature in GNOME just stores the screenshots in the home directory with un-organized filenames, such as Screenshot 2022-01-25 at 13-31-51 Micski.png. If you are taking screenshots of a website, that uses special characters in its title, then this could lead to trouble. The solution is to use an alternative screenshot tool. In the past, Shutter was a nice alternative, but it is no longer available for FreeBSD. The solution is ImageMagick, which has a nice screenshot tool, that is called import.
Create a screenshot script, that GNOME can run from a keyboard shortcut.
Create a screenshot script, that runs from your bin directory and runs ImageMagick import. You can also let it run from a system wide bin directory. This also makes it possible for you to modify it as necessary. In this example, the screenshot will be saved in a directory and be named in ISO 8601 format.
#!/bin/sh path="$HOME/unsorted/" date="`date "+%Y-%m-%d-%H-%M-%S"`" screenshot="$path$date-screenshot.png" /usr/local/bin/import $screenshot chmod 0600 $screenshot
Configure keyboard shortcut in GNOME settings.
Go to Settings, Keyboard, Keyboard Shortcuts, View and Customize Shortcuts and Custom Shortcuts. Click Add Shortcut. Set Name to Screenshot. Set Command to your script im-screenshot. Set Shortcut to PrtScr. GNOME uses the name Print for PrtScr.
You can now takes screenshots within the GNOME desktop environment by pressing PrtScr. A special mouse pointer appear and you can click the window, that wish to screenshot or you can click the top bar for a screenshot of the entire screen. The screenshot will be stored and named as defined in the script. In this example, it is stored in ~/unsorted and named in ISO 8601 format.