SELECTOOL(1) General Commands Manual SELECTOOL(1)

selectoolimage selection tool

selectool [-ms] [-f format] [-w width] [-c color] [-z size] file ...

selectool shows each of the given images and allows them to be selected or deselected. On exit, the given command is printed for each of the files.

Disable automatic redrawing when the window is resized (the -m stands for 'manual'). This may be useful on older machines that start accelerating global warming when the image is redrawn constantly while resizing. Note that this also disables exposure events, so the window has to be manually redrawn when switching back to it from another window.
Select all images by default.
format
Set the format to be used when the commands are output. See OUTPUT FORMAT for details.
width
Set the line width of the cross that is drawn over selected images in pixels (valid values: 1-99). Default: 5.
color
Set the color of the cross that is drawn over selected images. Default: #FF0000.
size
Set the Imlib2 in-memory cache to size MiB (valid values: 0-1024). Default: 4.

The command for each selected image is output using the format given by -f, or the default of ‘rm -- '%f'’.

The following substitutions are performed:

%%
Print ‘%’.
%f
Print the filename of the image. Warning: This is printed as is, without any escaping.

If an unknown substitution is encountered, a warning is printed to standard error and the characters are printed verbatim.

ARROW LEFT
Go to the previous image.
ARROW RIGHT
Go to the next image.
RETURN
Deselect the current image and go to the next image.
SHIFT + RETURN
Deselect the current image and go to the previous image.
d
Select the current image and go to the next image.
D
Select the current image and go to the previous image.
t
Toggle the selection status of the current image.
SPACE
Redraw the window. This is useful when automatic redrawing is disabled with -m.
q
Exit the program, printing the set command for all selected images. If the window is closed through some other means, no commands are printed.

The selectool utility exits 0 on success, and >0 if an error occurs.

Normal usage to delete selected images:

$ selectool *.jpg > tmp.sh
$ sh tmp.sh

Or, if you're brave:

$ selectool *.jpg | sh

The original use case for selectool was to quickly delete images that have been recovered using programs like photorec(8) or foremost(8). When used on a system partition, these programs generally recover a lot of images that aren't important, which then need to be sorted manually. Other programs that the author used for this task in the past were not ideal because they either were much too slow or allowed mistakes to be made too easily by deleting images immediately.

It is also possible to do more advanced things. For instance, to move the selected images into a different directory, something like this can be done:

$ selectool -f "mv -- '%f' '/path/to/dir/'" *.jpg | sh

Note that no great care has been taken to deal with filenames containing single quotes. That is left as an exercise to the reader (hint: just don't have filenames containing quotes).

croptool(1), mv(1), rm(1), foremost(8), photorec(8)

lumidify <nobody@lumidify.org>

The filenames are printed without any escaping, so filenames with quotes may cause issues depending on the output format.

Transparent portions of images should probably be shown differently, but I'm too lazy to fix that and don't really care at the moment.

May 14, 2024