You are not logged in.

#1 2009-02-11 11:45:45

headhunter242
Member
Registered: 2007-08-07
Posts: 4

OSD messages for ThinkPad T60 (and more?)

Hi to all.
After upgraded to KDE4 I've lost the useful and pretty (comparing to tpb) OSD messages when changing volume, mute, etc...
So I've written a small script to get it again.
It used DBUS and KDIALOG and works fine also with KWIN 3D effects.
It is not heavy as CPU resource and it fit my needs on a ThinkPad T60.
I post it here for everybody that want's to use it. I don't have any idea and time to look to other places...
Copy and paste to a file and name it as you like.
chmod 754 to it.
Use "System Settings --> Advanced --> Autostart --> Add Script" to enable it at KDE4 startup for your user.

Bye, Dario.


------------------------- SCRIPT START ------------------------

#!/bin/bash                                                             
# Small shell script to enable some OSD messages for IBM/Lenovo ThinkPad T60

# Specify the number of timeout in seconds for the OSD messages
MESSTIMEOUT=3                                                 

prevvolume=$(cat /proc/acpi/ibm/volume | grep -w level: | cut -f3)
prevmute=$(cat /proc/acpi/ibm/volume | grep -w mute: | cut -f3)   
prevlight=$(cat /proc/acpi/ibm/light | grep -w status: | cut -f3)
volumedialog=0                                                   
waittime=1                                                       

while [ true ]; do
volume=$(cat /proc/acpi/ibm/volume | grep -w level: | cut -f3)
mute=$(cat /proc/acpi/ibm/volume | grep -w mute: | cut -f3)   
light=$(cat /proc/acpi/ibm/light | grep -w status: | cut -f3)

if [ "$prevvolume" -ne "$volume" ] ; then
   if [ "$volumedialog" -eq "0" ] ; then   
     D=$(kdialog --title "ThinkPad" --progressbar "                                    Volume                                    " 14)                         
     volumedialog=1                                                             
     counter=0                                                                 
     waittime=0.1                                                               
   fi                                                                           
   dbus-send --print-reply --dest=$D org.freedesktop.DBus.Properties.Set string:'org.kde.kdialog.ProgressDialog' string:'value' variant:int32:$volume > /dev/null                                                                               
   counter=0                                                                   
fi                                                                             

if [ "$volumedialog" -eq "1" ] && [ "$counter" -gt "$(( $MESSTIMEOUT * 10 ))" ] ; then
   dbus-send --print-reply --dest=$D org.kde.kdialog.ProgressDialog.close > /dev/null
   volumedialog=0
   waittime=1
fi

if [ "$prevmute" != "$mute" ] ; then
   kdialog --passivepopup "Mute $mute" $MESSTIMEOUT
fi

if [ "$prevlight" != "$light" ] ; then
   kdialog --passivepopup "ThinkLight $light" $MESSTIMEOUT
fi

sleep $waittime
prevvolume=$volume
prevmute=$mute
prevlight=$light
counter=$(( $counter + 1 ))

done


-------------------------- SCRIPT END -------------------------

Offline

Board footer

Powered by FluxBB