1 | #!/usr/bin/env python
|
---|
2 | # -*- coding: utf-8 -*-
|
---|
3 |
|
---|
4 | import sys
|
---|
5 | import dbus
|
---|
6 | import pprint
|
---|
7 |
|
---|
8 | try:
|
---|
9 | message = sys.argv[1]
|
---|
10 | except:
|
---|
11 | message = sys.argv[0]
|
---|
12 |
|
---|
13 | knotify = dbus.SessionBus().get_object("org.kde.knotify", "/Notify")
|
---|
14 |
|
---|
15 | # interface for knotify,
|
---|
16 | # taken from knotify.h
|
---|
17 | # int event(
|
---|
18 | # const QString &event,
|
---|
19 | # const QString &fromApp,
|
---|
20 | # const QVariantList& contexts ,
|
---|
21 | # const QString &title,
|
---|
22 | # const QString &text,
|
---|
23 | # const QByteArray& pixmap,
|
---|
24 | # const QStringList& actions,
|
---|
25 | # int timeout,
|
---|
26 | # qlonglong winId );
|
---|
27 |
|
---|
28 |
|
---|
29 | # predefined notify settings, see
|
---|
30 | # find /usr/share/kde4/apps -name *.notifyrc
|
---|
31 | # grep -v '[a-z]\[' /usr/share/kde4/apps/kde/kde.notifyrc
|
---|
32 |
|
---|
33 | #i = knotify.event( "warning", "mettenmeier_batteriemanagement", [], "Batteriemanagement", m, [0,0,0,0], [], 0, dbus_interface="org.kde.KNotify")
|
---|
34 |
|
---|
35 | # use notify settings from powerdevil
|
---|
36 | #i = knotify.event( "criticalbattery", "powerdevil", [], "Batteriemanagement", m, [], [], 0, dbus_interface="org.kde.KNotify")
|
---|
37 | i = knotify.event( "notification", "kde", [], "knotify-client", message, [], [], 5, dbus_interface="org.kde.KNotify")
|
---|
38 | #pprint.pprint(i)
|
---|
39 | print i
|
---|