![]() |
This HowTo gives information on how to use the LEDs to display information on Unslung, and more specifically on how to use the disk 1 LED to indicate new mail, and disk 2 LED to indicate a new private message in irssi. Taking control of the LEDs in UnslungI couldn't get Unslung to stop updating the LEDs, so instead i made a script to update the disk LEDs by running Set_Led every second, setting them on if a file exists, and off otherwise. If the the files Make sure the directory mkdir /led chmod 777 /led
#!/bin/sh
while [ 1 ]
do
if [ -f /led/disk1on ]
then
Set_Led turn_on1
else
Set_Led turn_off1
fi
if [ -f /led/disk2on ]
then
Set_Led turn_on2
else
Set_Led turn_off2
fi
sleep 1
done
Make sure it's executable by running Run ledsetter.sh as root in the background with
#!/bin/sh /root/ledsetter.sh & Make sure it's executable by running Making disk 1 LED indicate new mailThis works by checking for new mail through fetchmail, and make sure the file Install fetchmail by running Then (if user is joe) create Make sure the file is secret by running
#!/bin/sh
if /opt/bin/fetchmail -c --service 143
then
touch /led/disk1on
else
rm /led/disk1on
fi
#!/bin/sh /usr/bin/fetchmail -c --service 143 && sudo leds disk-1 fast || sudo leds disk-1 off Debian note: I couldn't figure out how to allow regular users to change led settings, so i used sudo (apt-get install sudo) instead. But sudo by default asks for a password every 15minutes, i changed this by running (as root) "visudo" and add permissions to ex. user joe: Defaults:joe timestamp_timeout=-1 ... vk ALL=(ALL) ALL Make sure it's executable by running The fetchmail parameter To make this run every 10 minutes add the following line to Making disk 2 LED indicate new private messages in irssiThis works by using a perl script for irssi that creates Make sure the
use strict;
use Irssi;
sub fhilight {
system("touch /led/disk2on 2> /dev/null");
}
sub fseenhilight {
system("rm /led/disk2on 2> /dev/null");
}
Irssi::signal_add('message private', 'fhilight');
Irssi::signal_add('window changed', 'fseenhilight');
Make sure
use strict;
use Irssi;
sub fhilight {
system("sudo leds disk-2 fast");
}
sub fseenhilight {
system("sudo leds disk-2 off");
}
Irssi::signal_add('message private', 'fhilight');
Irssi::signal_add('window changed', 'fseenhilight');
And to actually load this script run "/script load fhilight" in irssi. |