Hi misc@,

during the last weeks, I have reviewed quite some image tools out there
because I needed one to set a wallpaper on my X server. I am not using
a sophisticated desktop environment, so there was a need for a
standalone tool. Let's keep it short: I have found and reported many
bugs, and had to stop eventually after accepting that these libraries
are either legacy/unmaintained or beyond repair (calling printf and free
in signal handlers, anyone?).

To overcome this issue, I decided to write a simple utility, with the
common OpenBSD focuses: Simplicity, security, doing exactly one thing.

The tool supports three file formats:

- JPEG; virtually everyone uses it
- PNG; most popular lossless format
- XPM; well, it's the most common agreement on X installations out there

I still want to be able to zoom into my pictures, so these modes of
operations are supported:

- tile; tiles the image next to each other until screen/output is filled
- center; centers the image
- maximize; maximizes the image without cutting things off
- stretch; destroys aspect ratio and fills the whole screen/output
- zoom; maximizes the image and cuts things off, screen/output is filled

To get nice results, xwallpaper directly uses pixman for pixel
operations. In case you don't know pixman: It is the direct foundation
for the xorg-server to do pixel operations. No further dependencies!

Next to this, it avoids using the old (deprecated) X11 libraries. Found
bugs in them as well and also got repeatedly told that they are not
supposed to be used anymore either. So I decided to go with XCB.

Multi monitor setups are too regular by today to completely ignore them
or using Xinerama with its weird numbering. Instead, it uses RandR if
available, which makes it pretty nice to use. It even supports different
modes (tiling, centering etc.) on different outputs! And if you are used
to run xrandr, the syntax will be very familiar.

Last but not least, the tool is tightly pledged. We all know that file
formats suck and they contain lots of bugs. For increased security, I
have included pledge support right from the start. Before even one
instruction of one of these image libraries is called, pledge is already
down to "stdio". That's really tight! :)

All in all, it can be compiled with 0 dependencies with xenocara. Keep
in mind that you just have XPM support then, though.

It's not in ports (yet?). It would be really great if you can give it a
try, experiment a bit, and give me feedback. If you are an XCB expert
and/or into code reviewing: Please do so! And if you have a big endian
machine, it would be great if you can see if it works there as well.

The project as well as its release files can be found on GitHub:
https://github.com/stoeckmann/xwallpaper


Hope someone finds this tool useful, too.

Tobias

Reply via email to