This is a continuation to earlier post which speaks of configuring hotkeys on a linux, using xbindkeys. In addition here is a package for slackware 13 64 bit – xbindkeys-1.8.3-x86_64.txz. Also the source is here, so if you are on a different distribution or another o/s, you can get the source and compile it for yourself. We shall be adding some more eyecandy by adding an on screen display (OSD). Here we shall make use of xosd. Again, the source for xosd is here. And the package is here – xosd-2.2.14-x86_64.txz.
So lets begin cooking. Get the packages and install them. Once this is done, we need to find the keycode using ‘xev’ as mentioned in earlier post. In this upgraded version, we run a small bash script which does the tasks of calling osd_cat to show some meaningful messages on the screen and run the application. In a few scripts we also read the status of some switches / variables and swap the status from on off or mute unmute.
Below is part of the .xbindkeysrc file
“sh $HOME/scr/launch.firefox.sh”
c:180
“sh $HOME/scr/headfone.switch.sh”
Mod4 + c:74
“sh $HOME/scr/wifi_switch.sh”
c:246
“sh $HOME/scr/launch.amarok.sh”
c:163
“sh $HOME/scr/master.audio.switch.sh”
c:121
“sh $HOME/scr/launch.dolphin.sh”
c:156
And here we have the scripts
if [ `amixer sget Front | grep -i 'Front Left:' | grep -c off` == "1" ]; then
amixer -q sset Master unmute
amixer -q sset Side unmute
amixer -q sset Front unmute
amixer -q sset Center unmute
amixer -q sset LFE unmute
amixer -q sset Surround unmute
osd_cat -d 2 -c red -p middle -A centre -f “-adobe-helvetica-bold-r-normal-*-*-300-*-*-p-*-*-*” $HOME/scr/messages/headfone.switch.off.txt &
sleep 3s
kill %1
else
# amixer -q sset Master mute
amixer -q sset Side mute
amixer -q sset Front mute
amixer -q sset Center mute
amixer -q sset LFE mute
amixer -q sset Surround unmute
osd_cat -d 2 -c green -p middle -A centre -f “-adobe-helvetica-bold-r-normal-*-*-300-*-*-p-*-*-*” $HOME/scr/messages/headfone.switch.on.txt &
sleep 3s
kill %1
fi
amarok &
osd_cat -d 2 -p middle -A centre -c green -f “-adobe-helvetica-bold-r-normal-*-*-300-*-*-p-*-*-*” $HOME/scr/messages/amarok.txt &
sleep 2s
kill %2
exit 1
if [ `/sbin/iwconfig wlan0 | grep -c Tx-Power=off` == "1" ]; then
sudo /sbin/iwconfig wlan0 txpower on
osd_cat -d 2 -p middle -A centre -c green -f “-adobe-helvetica-bold-r-normal-*-*-300-*-*-p-*-*-*” $HOME/scr/messages/wifi.on.txt &
sleep 3s
kill %1
#echo “code is beyond”
else
sudo /sbin/iwconfig wlan0 txpower off
osd_cat -d 2 -p middle -A centre -c red -f “-adobe-helvetica-bold-r-normal-*-*-300-*-*-p-*-*-*” $HOME/scr/messages/wifi.off.txt &
sleep 3s
kill %1
#echo “working
“
fi
http://sites.google.com/site/psibianopen/Home/wifi.off.jpeg?attredirects=0
