Tuesday 18 January 2011

doing CTRL-ALT-F1 from a script to adjust brighness

It is odd, but for some reason I have to swap terminals, using chvt to a text term,
to adjust brightness on my laptop.

So, what I have to do is: change to /dev/tty1, adjust brightness, change back into X.

I created a script called 'dim', and set sudo to allow it to be run without password
for me:

#!/bin/bash

if [ "x$1" == "x" ]
then
        cat /proc/acpi/video/PEGP/LCD/brightness
        exit;
fi

if [ "x$DISPLAY" != "x" ]
then
        chvt 1
fi

echo -n $1 > /proc/acpi/video/PEGP/LCD/brightness

if [ "x$DISPLAY" != "x" ]
then
        chvt 8
fi

No comments:

Post a Comment