Bug 529 - Execute Script on Statechange
Status:
RESOLVED FIXED
Component:
Core
Version:
unspecified
Hardware:
All All
Importance:
P4 enhancement
Target Milestone:
---
Assignee:
Rob Caelers
URL:
http://matt.wronka.org/stuff/projects/icpp/workrave/
Depends on:
Blocks:
Reported:
May 16 2006 08:36:44 UTC
by:
Matthew Wronka
Modified:
Mar 11 2008 19:58:48 UTC
| Who | When | What | Removed | Added |
|---|---|---|---|---|
| Rob Caelers | Aug 27 2007 14:03:54 UTC | priority | P5 | P4 |
| Rob Caelers | Mar 11 2008 19:58:48 UTC | status | NEW | RESOLVED |
| resolution | FIXED |
Description
Matthew Wronka May 16 2006 08:36:44 UTC
I wanted an easy way of hooking workrave up with other programs. I figured being able to call an external script was the easiest way of accomplishing this. I have a patch for Linux/Unix-like systems (tested only on Linux unfortunately). http://matt.wronka.org/stuff/projects/icpp/workrave/workrave-1.8.1-statechange_exec.patch This patch causes workrave to look for and run the script ~/.workrave/statechange using '/bin/sh'. The script gets passed two arguments: the first argument is the new state, the second is the prior state.
Comment 1
Rob Caelers Mar 11 2008 19:58:48 UTC
Thanks. Workrave now supports events through dbus:
obj = bus.get_object("org.workrave.Workrave", "/org/workrave/Workrave/Core")
workrave = dbus.Interface(obj, "org.workrave.CoreInterface")
workrave.connect_to_signal("MicrobreakChanged", microbreak_signal)
def microbreak_signal(self, progress):
if progress == "prelude":
print "Micro break warning"
elif progress == "break":
print "Micro break started"
elif progress == "none":
print "Micro break idle"
else:
print "Unknown progress for: %s" % progress