Turning off Radeon LCD backlight when GNOME screensaver is activated

2008-02-13 19:15

I wrote a quick and dirty script that turns on and off ATI Radeon LCD backlight by monitoring DBUS events to detect the activation and deactivation of GNOME screensaver. It requires the radeontool package to be installed and it needs to be set with suid flag (i.e. chmod u+s /usr/sbin/radeontool). Please feel free to launch the following script when your GNOME session starts:
#!/bin/sh
if [ "x`pgrep -of 'radeon-watch'`" != "x$$" ]; then
exit 1
fi
radeontool dac on
radeontool light on
{
dbus-monitor --session --monitor "type='signal',path='/org/gnome/ScreenSaver',interface='org.gnome.ScreenSaver'" | while read -r EVT; do
echo "$EVT" | grep -qi "SessionIdleChanged"
if [ "$?" = '0' ]; then
read -r EVT_VAL
echo "$EVT_VAL" | grep -qi "true"
if [ "$?" = '0' ]; then
radeontool dac off
radeontool light off
else
radeontool dac on
radeontool light on
fi
fi

echo "$EVT" | grep -qi "AuthenticationRequestBegin"
if [ "$?" = '0' ]; then
radeontool dac on
radeontool light on
fi

echo "$EVT" | grep -qi "AuthenticationRequestEnd"
if [ "$?" = '0' ]; then
radeontool dac off
radeontool light off
fi
done
} &
Please note that I tested this script with my old ThinkPad X31, so you might not need this script if you have the recent laptop or you are using other video chipset.
---

Comments

No comments yet. Be the first!

 
  • Preview 버튼 누르고 reCAPTCHA 입력 후 Submit 버튼까지 눌러야 실제로 게시됩니다.
  • Make sure to answer the reCAPTCHA and click the Submit button to get your comment posted. It's not enough to click the Preview button only! -- See why.
---