Notify-osd does not handle actions. This is an explicit design decision by the developers. As the design spec states, "Other than that hover effect, bubbles should not directly respond to input devices in any way." The it also asserts that when actions are requested, it will fallback to an alert box:
For cases where applications have expected the notification system to
allow interactivity without checking whether it actually does, and
cases where applications have expected the notification system to
display a notification indefinitely, Notify OSD should show an alert
box as a fallback.
While it's up for debate whether or not that is a good decision,
Notify-osd is an implementation of the Freedesktop notification spec,
which clearly states that it is the responsiblity of the client
to make sure the server supports the desired ability:
Clients should try and avoid making assumptions about the presentation
and abilities of the notification server. The message content is the
most important thing.
Clients can check with the server what capabilities are supported
using the GetCapabilities message.
You can test for notification server capabilities with something like:
import pynotify
pynotify.init("Test Capabilities")
caps = pynotify.get_server_caps()
if caps and 'actions' in caps:
# We support actions, so add a button.
notification = pynotify.Notification("Can we use actions?", \
"Yup, we sure do.")
notification.add_action("ignore", "Ignore", ignore_cb)
else:
notification = pynotify.Notification("Can we use actions?", \
"Nope, we don't support actions.")
notification.show()