Back to Silas S. Brown's home page | X11 configuration
VNC with inverted colours
These instructions are no longer being maintained, because modern TFT
monitors are not so bad to look at when running one of the few
applications that cannot be inverted. The instructions below may or may not
work on newer versions of Debian, e.g. you may have to replace vncserver
with vnc4server.
People with certain eyesight conditions find bright
backgrounds difficult to work with, but some applications
cannot be configured otherwise. If you have to use one of
those applications, it might help a little to use a program
that intercepts the display at a low level and inverts all
the colours. This is a last resort as
the result is unlikely to be optimal.
The following hack will do this on a Linux system. It relies on VNC (Virtual Network Computing) and we will be making a small modification to the VNC viewer.
Note: This works as-is only for Debian-based distributions. If your distribution is not Debian then you need to modify this.
First, download invert-vnc.diff
and save it as /tmp/invert-vnc.diff
Then paste the following into a root prompt: the lines are long):
apt-get --no-upgrade install xnest libjpeg62-dev \ xvncviewer vncserver vnc-common libvncauth0 dpkg-dev cd /tmp apt-get source xvncviewer cat invert-vnc.diff | patch vnc-*/vncviewer/desktop.cThen, if you are using Debian 3.0 aka Woody, paste in the following (ONLY if you are using Woody):
cd vnc-*/vncviewer gcc-2.95 -I ../include/ -I ../vncviewer/ \ -I ../Xvnc/lib/zlib $( echo *.c | sed -e 's/corre.c//' \ -e 's/hextile.c//' -e 's/rre.c//' \ -e 's/zlib.c//' -e 's/tight.c//') \ /usr/X11R6/lib/libXt.so.6.0 \ /usr/lib/libjpeg.so.62 \ /usr/lib/libvncauth.so.0 \ /usr/X11R6/lib/libXaw.so.7 \ /usr/lib/libz.so.1 mv a.out /usr/local/bin/invert-vncFor Debian versions later than 3.0, paste the following instead of the above:
cd vnc-* apt-get --no-upgrade install linux-kernel-headers ./configure && make && mv vncviewer/vncviewer \ /usr/local/bin/invert-vncFinally, paste in the following script. You might like to change the variables at the beginning, especially
Geometry
. Security note: all local users will be able to
interfere with your X display.
cat > /usr/local/bin/run-inverted <<'EOF' #!/bin/bash Geometry=640x480 VNCDisplay=98 XnestDisplay=99 Xvnc :$VNCDisplay -geometry $Geometry -ac \ -once -deferglyphs 16 -nolisten unix & vnc_server_pid=$! Xnest -geometry $Geometry -ac \ -nolisten tcp :$XnestDisplay & xnest_pid=$! sleep 3 DISPLAY=:$VNCDisplay xsetroot -solid white DISPLAY=:$VNCDisplay $* & application_pid=$! DISPLAY=:$XnestDisplay invert-vnc \ -encodings raw -fullscreen :$VNCDisplay & DISPLAY=:$VNCDisplay xset s off DISPLAY=:$XnestDisplay xset s off wait $application_pid kill $vnc_server_pid ; kill $xnest_pid EOF chmod +x /usr/local/bin/run-invertedIf you use a different keyboard layout (e.g. Dvorak) then you may need to add the appropriate
xmodmap
command to
/usr/local/bin/run-inverted
(use export
DISPLAY=:$VNCDisplay
first; do not send it to
:$XnestDisplay
or the real display). This
should go before the wait
. setxkbmap
is less likely to work than xmodmap
.The program is now ready for use. Use it like this (as an ordinary user, not root):
run-inverted applicationwhere
application
is the command to run the
application that you wish to use with inverted colours. (If
you need a window manager, create a script that launches the
window manager and the application and run that.)
Copyright and Trademarks
All material © Silas S. Brown unless otherwise stated.Debian is a trademark owned by Software in the Public Interest, Inc.
Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.
VNC is a registered trademark of RealVNC Limited.
Any other trademarks I mentioned without realising are trademarks of their respective holders.