The i3 FAQ has migrated to All content here is read-only.
Ask Your Question

i3lock: setting the image background in Ubuntu Precise

asked 2012-09-25 11:13:36 +0000

anonymous user


updated 2012-09-26 09:21:27 +0000

The version included in the Ubuntu Precise repository is "i3lock: version 2.2 (2011-11-06) © 2010-2011 Michael Stapelberg". This version does not seem to honor the '-i' option for setting a PNG image. (just in case, I tried with a JPG too, still no luck)

I've found in a question on this very faq website mentioned that in Fedora the '-i' is not compiled in. Is that the case for Precise too? (however, both the man page and the usage '--help' message have the '-i image.PNG' option shown as available).

Update: Actually i3lock works ok, but the problem lies with the Ubuntu default background file and is quite silly: I was attempting to set as image "/usr/share/backgrounds/warty-final-ubuntu.png" (which happens to be the default background used by Precise, the one I am currently using as background now and the only .png file in that directory, the others being .jpg). However, despite having a .png extension, that image file is actually a JPEG ... :| (a tiny warning on stderr that the image failed to load or is not a valid png could help in similar situations, but it's up to you)
Sorry for the noise.

edit retag flag offensive close merge delete


There already was a message, but it only showed when you ran i3lock in debug mode. I just changed the code to print it always since I don’t see any reason for having that in debug mode only. Unfortunately, the message doesn’t give a good reason (like "you passed a JPEG file"), improvements welcome.

Michael gravatar imageMichael ( 2012-09-26 09:23:51 +0000 )edit

Thanks. Any hint that something is wrong with the file is more than good enough and anyhow way better than no message.

Chris gravatar imageChris ( 2012-09-26 09:31:29 +0000 )edit

Any reason why it can't be a JPEG image?

diegueus9 gravatar imagediegueus9 ( 2014-05-08 20:50:12 +0000 )edit

1 answer

Sort by » oldest newest most voted

answered 2012-09-25 12:27:04 +0000

Michael gravatar image

You can verify whether it should work by using

ldd $(which i3lock) | grep cairo

If that prints a line such as the following one, your version of i3lock has been compiled with cairo support: => /usr/lib/x86_64-linux-gnu/ (0x00007f170526f000)

Note that the presence of the -i flag in the --help message should be a definitive indicator, too (unless the distribution messes with our source code).

edit flag offensive delete link more

Question Tools


Asked: 2012-09-25 11:13:36 +0000

Seen: 2,357 times

Last updated: Sep 26 '12