As often, reverting to a (very) basic, but nevertheless complete functionality feels weird, but in a way refreshing. Not sure if I would use it though.
Although the bottom of Calcurse's window suggests an option to pipe, and Calcurse's website mentions "user-configurable notification system" I couldn't find a way to use it for automatic scheduled notifications of all events.
At the same time: indeed such a reminder functionality would be a useful addition. The script below can be used as a plug- in for
calcurse to show reminders. I hope you find it useful.
It is extremely easy to use; simply run the script in the background. All it does is check the events for today (updated twice per minute), and run notifications at an arbitrary time before expiration.
What is needed to create reminders
The output of the command:
* Free today!
- 12:00 -> ..:..
See if this script does its job :)
It immediately occurs that the scheduled items start with a "-", while items for all day start with "*". What we need to do is create two groups (lists) of items:
- the scheduled ones
- the unscheduled ones
Of the first category, we need to parse out the time, convert it into a format we can calculate with, so we can show reminder at
n- minutes before expiration.
Subsequently, we need to "keep an eye on the clock", to compare the set time (of the event) to the current time. If the time span between the two enters the set warning time, simply show the notification.
Finally, to prevent repeated notification, we need to add the item to a "done" list.
Additionally, the script cleans up the "done" list; if an item does not occur in today's items anymore (either if you removed it or the day switched during your session), the items are removed automatically.
On startup (log in)
On an arbitrary time before expiration (in this case 15 minutes)
warn = int(sys.argv)
# convert set time into a calculate- able time
return [int(n) for n in t.split(":")]
def calc_diff(t_curr, t_event):
# calculate time span
diff_hr = (t_event - t_curr)*60
diff_m = t_event - t_curr
return diff_hr + diff_m
def cleanup(done, newlist):
# clean up "done" -lists
for item in done:
if not item in newlist:
def show_time(event, s = ""):
# show scheduled event
hrs = str(event); mnts = str(event)
mnts = "0"+mnts if len(mnts) != 2 else mnts
subprocess.call(["notify-send", s, "At "+hrs+":"+mnts+" - "+event])
startups = ; times = 
currtime = convert(time.strftime("%H:%M"))
events = [l.strip() for l in get(["calcurse", "-a"]).splitlines()][1:]
# arrange event data:
groups = ; sub = 
for l in events:
if l.startswith("* "):
groups.append([l.replace("* ", "")])
elif l.startswith("- "):
sub = 
# run notifications
for item in groups:
# on startup:
if not item in startups:
# all- day events
if len(item) == 1:
subprocess.call(["notify-send", "Today - "+item])
# time- specific events
elif len(item) == 2:
# as a reminder:
if all([len(item) == 2, not item in times]):
span = calc_diff(currtime, item)
if span <= warn:
# clean up events
startups = cleanup(startups, groups); times = cleanup(times, groups)
How to use
- Copy the script into an empty file, save it as
Test- run it with the time you'd like to be warned (before expiration time, in minutes) as an argument. An example, to run reminders 30 minutes before your appointment:
python3 /path/to/run_ccursereminders.py 30
If it works as you wish, add it to Startup Applications: choose Dash > Startup Applications > Add. Add the command
/bin/bash -c "sleep 30 && python3 /path/to/run_ccursereminders.py 30"
where the last
30 is the number of minutes to warn you before an appointment expires