137
by Jason Conti
Adding an option to blacklist notifications based on app_name. Applications to be blacklisted should be listed in the file ~/.config/recent-notifications/blacklist, one app_name per line. The app_names are case-sensitive and are listed in the notifications as "from app_name" such as "from Gwibber" or "from Pidgin". They can also be found in ~/.cache/recent-notifications.log on the app_name lines. Thanks to Dinero Francis for reporting the issue. |
1 |
import pygtk |
2 |
pygtk.require("2.0") |
|
3 |
import pynotify |
|
4 |
import sys |
|
5 |
||
6 |
def main(): |
|
7 |
if len(sys.argv) < 2: |
|
8 |
print "usage: test-appname.py app_name" |
|
9 |
sys.exit(1) |
|
10 |
||
11 |
app_name = sys.argv[1] |
|
12 |
||
13 |
if not pynotify.init(sys.argv[1]): |
|
14 |
print "Failed to initialize notifications." |
|
15 |
sys.exit(1) |
|
16 |
||
17 |
n = pynotify.Notification("Message from " + app_name, |
|
18 |
"This is a test, this is only a test.") |
|
19 |
||
20 |
if not n.show(): |
|
21 |
print "Failed to send notification." |
|
22 |
sys.exit(1) |
|
23 |
||
24 |
if __name__ == "__main__": |
|
25 |
main() |