xbrightness FreeBSD port + GUI • 30 Jan 2010

I use a Dell FPW2405 for years now. It's a nice monitor which can be rotated to portrait mode and it remains perfectly readable. But it has a flaw: the brightness can't be adjusted when it's hooked up via the DVI connector. This is a nuisance since at night it's much too bright, to the point that it hurts my eyes. That was the reason I used the VGA input all the time, but I wanted to drive it with a better video card. I needed something to dim it. KDE3's Control Center didn't offer a solution, but after some searching I found xbrightness. It wasn't in the ports tree yet, so I decided to make a ports entry for it.

Sun through trees in forest; crop from a picture found at www.lostpixels.hu

Making a port

Basically one follows the Porter's Handbook: create a Makefile, some description files, put them in an archive, and send in a 'port change request' PR. (PR stands for 'Problem Report').

Xbrightness is a very simple program. There was already a similar utility in the ports: xgamma. I modeled the Makefile and description files on it, and ended up with this:

# New ports collection makefile for: xbrightness # Date Created: 30 January 2010 # Whom: Michiel Overtoom PORTNAME= xbrightness PORTVERSION= 0.3 CATEGORIES= x11 MASTER_SITES= http://disjunkt.com/xbrightness/ ftp://ftp.motoom.net/files/ MAINTAINER= motoom@xs4all.nl COMMENT= Brightness and gamma correction through the X server USE_XORG= x11 xxf86vm ice xmu xt xaw USE_IMAKE= yes PLIST_FILES= bin/xbrightness MAN1= xbrightness.1 .include <bsd.port.mk>

And this pkg-descr:

This package contains xbrightness, a commandline tool for altering the brightness (and optionally gamma) through the X server. WWW: http://disjunkt.com/xbrightness/

Because the port only installs one file, it's not necessary to make a pkg-plist. Furthermore, I mirrored the current version of the source archive on my personal FTP site. I then generated the checksums with make makesum and tested if the port would install and uninstall properly. portlint didn't complain either. Next, I created a shar archive of the files and used send-pr to send it in as a 'change request' in the 'ports' category. To my surprise, the port was added the next day already!

But wait, there's more: a GUI!

At first I had some shell scripts named 'full', 'medium' and 'dark' which would call xbrightness with various constants. This didn't work very well, I needed something which allowed me finer control of brightness, interactivity and an instantaneous feedback, and easily accessible from the desktop with an icon. Hence a GUI was born. I chose Python in combination with Qt4 for that:

screenshot of qtbrightness

The program qtbrightness.py can be downloaded from github.


A nice addition to xbrightness would be to be able to adjust the color temperature, so you can make the screen a 'warmer' tint. A bit like stereopsis' F.lux does that, or Charcoal's Shades for OSX. Of course, this would mean an extra 'color temperature' slider in qtbrightness too.

Another good thing would be that qtbrightness would remember its settings in a rc file, and read and use that on the next run.


Leave a comment

name (required)

Fork me on GitHub

content last edited on April 25, 2011, 19:02 - rendered in 2.61 msec