[Evolution-hackers] Birthday reminder script
- From: <vseguip gmail com>
- To: evolution-hackers gnome org
- Subject: [Evolution-hackers] Birthday reminder script
- Date: Tue, 31 Jan 2006 15:54:28 +0100
Hi all
RustyJames at the #evolution IRC channel asked if evo could remind
him of birthdays. It seems like it can't right now, so I wrote a
simple script in Ruby with the SWIGforEDS bindings just to showcase
them and because I really want to get some feedback :-).
You will need SWIGforEDS installed and zenity.
Script:
#!/usr/bin/ruby
require 'evolution'
source_uid=""
already_notified=Hash.new
source=nil
Evolution.get_esource_groups.each{ |group|
source=group.find { |s| s.uid==source_uid}
break if source
}
cal=Evolution::ECal.new(source)
run=true
trap ("INT"){run=false}
trap ("HUP"){run=false}
while(run) do
sleep(300) #sleep 5min
cal.each { |ev|
if ev.dtstart.yday == Time.now.yday and (not already_notified[ev.uid])
system "zenity --notification --text '#{ev.summary}'"
already_notified[ev.uid]=true
end
}
end
You have to fill the source_uid with the appropiate value. To list the
calendar's source uid just run the following script:
#!/usr/bin/ruby
require 'evolution'
Evolution.get_esource_groups.each{ |group|
group.each { |s|
puts "#{s.name}: ·#{s.uid}"
}
}
Thi will list all the calendar present in your system together with
their uid. Just pick your birthday calendar uid and put it in the
placeholder of the above script (the source_uid ="" line). Then just
configure your session to run this every time you log in to Gnome and
that's it. It will popup a notification icon for every birthday that
there is today.
Cheers,
V. Seguí
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]