‹ back home

Announcing caffeine-ng v4.0.0

2022-07-12 #open-source #release

caffeine-ng is a small tool that shows an icon on the desktop status bar to temporarily disable screenlockers, screensavers, and screen dimming. It is typically used to temporarily avoid the screen turning off for things like watching a movie, a videoconference and alike.

Version 4.0.0 of caffeine-ng is now available. Many of the changes in this release are thanks to the contributors who have both written and tested many of these improvements, so a huge thanks to all those who have made this possible!

What’s new in v4.0.0

A major change that might break some scripts or integrations is that the command line portion has been rewritten in click, a rather popular Python library for handling everything command line related. Now, when typing a wrong command (or using --help), usage instructions and help messages are a lot more helpful and provide much better UX. Figuring out which options exist and what they do should be much simpler; just append --help to any [sub]command when in doubt.

That aside, support for inhibiting via Xfce’s presentation mode has been merged in, as well as multiple improvements to Pulseaudio support. A common usage of caffeine-ng to automatically avoid the system turning off when playing music. This feature works, but still needs improving.

For all the little details, see the changelog.

Moving to codeberg

I have recently also finalised moving this project to codeberg. Codeberg’s interface is very familiar to GitHub users, so this change should be the least disruptive to contributors in general.

The new home is now https://codeberg.org/WhyNotHugo/caffeine-ng. Please update your bookmarks. The previous home will remain as a read-only mirror, mostly to avoid breaking existing links. Another upside of Codeberg for this particular scenario, is that all issues and PRs can be copied over, retaining all history in the new home and allowing discussions to continue smoothly.

This forge is entirely open source, and move is part of my initiative to have open source projects hosted purely on open source platforms.

I’d like to thank the gitea developers for writing this open source forge, and the codeberg community for hosting this service for public usage.


Installation instructions remain the same as always. The AUR package has been updated for ArchLinux users. The release tags are signed with my new GPG key, 0x9D062837.

Future improvements

caffeine-ng is far from perfect. These are some of the main items I currently have in sight:

Using the MPRIS API

This would allow caffeine inhibiting screen saver or suspension as soon as any compatible media player is running. While this isn’t 100% of the media player out there, it would still improve the experience in many scenarios by a lot.

I’m currently not planning on working on this myself, so if anyone wants to contribute, I’m happy to provide guidance. For discussion and details on this particular topic, see the the existing issue.

Wayland support

I am still not 100% certain how to achieve this. The relevant wayland protocol allows telling the compositor “inhibit screen locking while a given window1 is open”, so it will work for whitelist applications and fullscreen applications, but there’s no obvious solution to inhibit the screensaver when it’s manually requested by the user. I do plan on researching this a bit in the near future, since I’d like to make use of this feature myself.

Exposing an API

Being able to control caffeine via command line or scripts has often been requested, and I’d personally want to have a waybar widget which can show the current state and control it.

I’m thinking of implementing this via a simple unix socket, but I’m hesitant of whether this is a good idea or not. My biggest concern is that this feels like there will be “yet another screensaver inhibition API”, but the reality is that there isn’t one that works everywhere anyway.

  1. A given surface, to be precise. ↩︎

Have comments or want to discuss this topic?
Send an email to ~whynothugo/public-inbox@lists.sr.ht (mailing list etiquette)

— § —