You are not logged in.

#1 2012-05-05 17:31:47

vacant
Member
From: downstairs
Registered: 2004-11-05
Posts: 816

claws mail calendar popup

This script uses libnotify to pop up events from claws-mail "vCalendar" plugin:

#!/bin/bash
# diary
# shows any claws-mail calendar events for today & tomorrow (& historical)
# if called with one or more parameters, also shows other future events

TODAY=`date +"%Y%m%d"`
TOMORROW=`date +"%Y%m%d" --date=tomorrow`

MSG=""
OVERDUES="\r"
TODAYS="\t\t"
TOMORROWS="\t"
OTHERS=""

grep -e SUMMARY -e DTSTART ~/.claws-mail/vcalendar/internal.ics -A1 | grep "\:" |grep -v 1970 | sed -n -e ":a" -e "$ s/Z\n/ /gp;N;b a"| sort >/tmp/zz

if  [[ `pidof notification-daemon` == "" ]]
    then
    /usr/lib/notification-daemon-1.0/notification-daemon > /dev/null &
    sleep 10
fi

while read LINE
do
    REVERSEDATE=`echo $LINE | cut -f2 -d":" | cut -b1-8`
    EVENT=`echo $LINE | cut -d":" -f3`
    if [[ $REVERSEDATE < $TODAY ]]
    then
        PRETTYDATE=`date +"%a %d %b" --date=$REVERSEDATE`
        OVERDUES=$OVERDUES$PRETTYDATE"\t"$EVENT"\r"
    elif [[ $REVERSEDATE == $TODAY ]]
    then
        TODAYS=$TODAYS$EVENT"\r\t\t\t"
    elif [[ $REVERSEDATE == $TOMORROW ]]
    then
        TOMORROWS=$TOMORROWS$EVENT"\r\t\t\t"
    elif [[ ${#1} > 0 ]]
    then
        PRETTYDATE=`date +"%a %d %b" --date=$REVERSEDATE`
        OTHERS=$OTHERS$PRETTYDATE"\t"$EVENT"\r"
    fi
done < /tmp/zz

if (( ${#OVERDUES} > 4 ))
then
    MSG="HISTORY"$OVERDUES
fi

if (( ${#TODAYS} > 4 ))
then
    MSG=$MSG"\rToday"$TODAYS
fi

if (( ${#TOMORROWS} > 4 ))
then
    MSG=$MSG"\rTomorrow"$TOMORROWS
fi

if (( ${#OTHERS} > 4 ))
then
    MSG=$MSG"\r"$OTHERS
fi

if (( ${#MSG} < 1 ))
then
    MSG="all quiet"
fi

notify-send --expire-time=0 "What's happening ..." "$MSG"

When I log in I like a notification of anything happening today or tomorrow (plus any historical events I've missed).

$ cat .config/autostart/diary.desktop 
[Desktop Entry]
Exec=/home/paul/diary
Name=diary
Type=Application
Version=1.0

When I click on the clock on lxpanel, I get all events from  vCalendar.

So, digital clock settings, action when clicked:

/home/paul/diary 1

Offline

Board footer

Powered by FluxBB