Eee 701 Planetoid

2014/01/16

Quick tip: invert colours on a Linux X11 display

Filed under: Linux, Software — Tags: , , , — Tim @ 17:33

One feature I have set up (and find very useful) on my iPhone, is a triple-press on the “home” button to invert the colours on the screen. (I won’t go into details on how to do this in iOS—it’s not the purpose of this post—but basically, look in Settings > General > Accessibility for details.) This is really handy for moments when you just don’t want to look at a very white screen (and unfortunately, iOS7 has lots of those), and a triple-press will turn white to black, to spare one’s eyes, blushes, etc…

I wondered if there was a not-too-complex way to set up a similar feature on a Linux machine, preferably at the X11 level (i.e. not tied into a particular window manager or desktop environment), and a quick Google search revealed I was in luck.

In short, there’s an X.org-based command-line utility called xcalib, which is mainly intended for monitor calibration, but which has a handy feature: yes, it can invert the current X display’s colours (effectively, giving you a negative of the display). The program isn’t included in Arch Linux’s main package repositories, so you’ll have to build/install xcalib from the AUR—it’s a tiny program, so that will barely take you longer than installing it from a repo would.

Once the program is installed, running

xcalib -i -a

(for “invert” and “action”—i.e. “do it”) will invert your display’s colours; running the same again will switch it back.

Very useful, and even more so if you assign it to a keyboard shortcut—each DE and WM has its own way of setting this up, but in Xfce you do this in Xfce menu > Applications > Settings > Keyboard > Application Shortcuts [tab]. I used Ctrl-Alt-I (for “invert”), but that’s just personal taste 🙂

Maybe this feature is already present in some DEs, but at least this one will work in any X.org environment—hope it helps you too!

Advertisements

Blog at WordPress.com.