2005-10-03 [paul] 1.9.14cvs68
[claws.git] / tools / asus_mailled.sh
1 #!/bin/bash
2 # Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 # Copyright (C) 2005 Colin Leroy <colin@colino.net
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
19 # This script, when used as newmail_notify_cmd (Configuration/Receive),
20 # makes the mail LED blink on new or unread mail for ASUS laptops with
21 # asus_acpi compiled in the kernel or loaded as module.
22
23 [ -f /tmp/mailcheck-$LOGNAME ] && exit
24 touch /tmp/mailcheck-$LOGNAME
25 last=0
26 while true; do
27         sleep 1
28         num=`sylpheed --status | cut -d' ' -f2`
29         if [ "$num" == "Sylpheed" ]; then
30                 #not running
31                 rm /tmp/mailcheck-$LOGNAME
32                 echo 0 > /proc/acpi/asus/mled
33                 exit
34         fi
35         if [ "$num" != "0" ]; then
36                 echo $last > /proc/acpi/asus/mled
37                 if [ "$last" == "0" ]; then
38                         last=1;
39                 else    
40                         last=0;
41                 fi
42         else
43                 echo 0 > /proc/acpi/asus/mled
44         fi
45 done;