Use Caps Lock LED as HDD LED (or custom) indicator
Well to change the led indicator on VT console you can use setleds
. So if you're in a VT you can just type
setleds
and you'll get your current led status. If you don't want to enable numlock, just light it up you can type:
setleds -L +num
It comes trickier in X and this is the "simplest" way to try it. Please note that X is usually ran as root so you'll either have to check permissions on X-windows tty or run it with root privileges. Usually X is tty7. /dev/console
should work being the system console and by that all VTs should be affected.
sudo su -c 'setleds -L +num < /dev/tty7'
I think this will also work:
sudo su -c 'setleds -L +num < /dev/console'
here's list of light options
[{+|-}num] [{+|-}caps] [{+|-}scroll]
If you don't have setleds
in you system, my guess is that you can get it from this emerge package sys-apps/kbd
.
If you are more of person who likes to code stuff here's a link to en example code to change leds in X. I did not test this, but just by looking the code looked ok.
And here's a shell script to do what you originally wanted. To have caps or other leds as HDD indicators.
#!/bin/bash
# Check interval seconds
CHECKINTERVAL=0.1
# console
CONSOLE=/dev/console
#indicator to use [caps, num, scroll]
INDICATOR=caps
getVmstat() {
cat /proc/vmstat|egrep "pgpgin|pgpgout"
}
#turn led on
function led_on()
{
setleds -L +${INDICATOR} < ${CONSOLE}
}
#turn led off
function led_off()
{
setleds -L -${INDICATOR} < ${CONSOLE}
}
# initialise variables
NEW=$(getVmstat)
OLD=$(getVmstat)
##
while [ 1 ] ; do
sleep $CHECKINTERVAL # slowdown a bit
# get status
NEW=$(getVmstat)
#compare state
if [ "$NEW" = "$OLD" ]; then
led_off ## no change, led off
else
led_on ## change, led on
fi
OLD=$NEW
done
check Gmail - blinks LEDs when e-mails received and says the number of emails
#!/bin/bash
echo "Checking for new email";
mails="$(wget --secure-protocol=TLSv1 --timeout=3 -t 1 -q -O - \
https://name1:[email protected]/mail/feed/atom \
--no-check-certificate | grep 'fullcount' \
| sed -e 's/.*<fullcount>//;s/<\/fullcount>.*//' 2>/dev/null)"
echo $mails;
#blink LEDs
if [ "$mails" -gt "0" ];
then
blink -s -r 5;
fi
#speak announcements
if [ "$mails" -gt "0" ];
then
espeak "$mails new emails in main account.";
fi
sleep 4;
blink;
exit
You could remove an HDD led from an old case, extend the wires and tie-wrap the wires to the keyboard wire, branch at the case, and plug direct into the HDD led jumper on the mainboard. Open the keyboard and hot-glue the HDD LED next to the capslock LED.
Software free and ugly? Check.