Re: [dev] Announcing a couple small X11 utilities

From: Max Schillinger <>
Date: Thu, 17 Aug 2023 23:08:58 +0200

> I don't have an answer to your question, but if all you need is
> cropping, I have a shameless plug for a moderately simple tool
> I wrote a while ago:

Nice tool! It works as described. Thank you.

I needed this patch to be able to compile it:

diff --git a/Makefile b/Makefile
index 9f7b524..0952346 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -20,8 +20,8 @@ DB_LDFLAGS = `pkg-config --libs xext`

-CROP_CFLAGS = ${CFLAGS} ${DB_CFLAGS} -Wall -Wextra -D_POSIX_C_SOURCE=200809L `pkg-config --cflags x11` `imlib2-config --cflags`
-CROP_LDFLAGS = ${LDFLAGS} ${DB_LDFLAGS} `pkg-config --libs x11` `imlib2-config --libs` -lm
+CROP_CFLAGS = ${CFLAGS} ${DB_CFLAGS} -Wall -Wextra -D_POSIX_C_SOURCE=200809L `pkg-config --cflags x11` `pkg-config --cflags --libs imlib2`
+CROP_LDFLAGS = ${LDFLAGS} ${DB_LDFLAGS} `pkg-config --libs x11` `pkg-config --cflags --libs imlib2` -lm

 all: ${BIN}

I found this fix here [1]. `imlib2-config` is deprecated if I got it

And it wasn't obvious to me that I have to exit croptool via dwm to get
some output. It would be nice if it supported a common shortcut like
Ctrl-q to quit.


For those interested in a solution using feh + sx4 + ImageMagick: I
hacked togehter this little wrapper script. It's far from perfect as it
depends on:

- xdotool being installed
- my shortcut to hide the status bar
- same being visible when the script is started
- a German keyboard layout.

But it works for me :-)

crop-image ~/Pictures/cropme.png /tmp/cropped.png


# disable dwm status bar
xdotool key super+shift+b
feh --borderless "$filename" &
sleep 0.5
# shift+plus = * in a German QWERTZ layout
# '*' zooms to 100% and moves the image to the top-left corner
xdotool search --class feh windowactivate --sync '%1' key 'shift+plus'
pkill feh
geom="$(echo ${geom#*,*,} | tr , x)+$(echo ${geom%,*,*} | tr , +)"
magick "$filename" +repage -crop "$geom" "$filename_cropped"
# enable dwm status bar
xdotool key super+shift+b
Received on Thu Aug 17 2023 - 23:08:58 CEST

This archive was generated by hypermail 2.3.0 : Fri Aug 18 2023 - 02:00:12 CEST