diff --git a/dunstify.c b/dunstify.c index 29768b9..689d9e3 100644 --- a/dunstify.c +++ b/dunstify.c @@ -26,7 +26,7 @@ static GOptionEntry entries[] = { "appname", 'a', 0, G_OPTION_ARG_STRING, &appname, "Name of your application", "NAME" }, { "urgency", 'u', 0, G_OPTION_ARG_STRING, &urgency_str, "The urgency of this notification", "URG" }, { "hints", 'h', 0, G_OPTION_ARG_STRING_ARRAY, &hint_strs, "User specified hints", "HINT" }, - { "actions", 'a', 0, G_OPTION_ARG_STRING_ARRAY, &action_strs, "Actions the user can invoke", "ACTION" }, + { "actions", 'A', 0, G_OPTION_ARG_STRING_ARRAY, &action_strs, "Actions the user can invoke", "ACTION" }, { "timeout", 't', 0, G_OPTION_ARG_INT, &timeout, "The time until the notification expires", "TIMEOUT" }, { "icon", 'i', 0, G_OPTION_ARG_STRING, &icon, "An Icon that should be displayed with the notification", "ICON" }, { "capabilities", 'c', 0, G_OPTION_ARG_NONE, &capabilities, "Print the server capabilities and exit", NULL}, diff --git a/test/notify.py b/test/notify.py deleted file mode 100755 index 6a8d057..0000000 --- a/test/notify.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python2 - -import pynotify -import sys - -from optparse import OptionParser - -def action_callback(arg): - print "action invoked (%s)" % (arg) - -parser = OptionParser() - -parser.add_option("-a", "--appname", dest="appname", action="store", default="dunst tester") -parser.add_option("-s", "--summary", dest="summary", action="store", default="summary") -parser.add_option("-b", "--body", dest="body", action="store", default="body") -parser.add_option("-u", "--urgency", dest="urgency", action="store", default="n") -parser.add_option("-A", "--action", dest="action", action="store", default=None) -parser.add_option("-w", "--wait", dest="wait", action="store_true", default=False) -parser.add_option("-t", "--timeout", dest="timeout", action="store", default=-1) -parser.add_option("-H", "--hint", dest="hint", action="store", default=None) -parser.add_option("-r", "--replaces", dest="id", action="store", default=0) -parser.add_option("-c", "--close", dest="close", action="store", default=0) -parser.add_option("-p", "--print_id", dest="print_id", action="store_true", default=False) - -(o, args) = parser.parse_args() - - -pynotify.init(o.appname) - -n = pynotify.Notification(o.summary, o.body) - -try: - if o.urgency[0] == "l": - n.set_urgency(pynotify.URGENCY_LOW) - if o.urgency[0] == "n": - n.set_urgency(pynotify.URGENCY_NORMAL) - if o.urgency[0] == "c": - n.set_urgency(pynotify.URGENCY_CRITICAL) -except: - pass - - -if o.action: - n.add_action(o.action.split(":")[0], o.action.split(":")[1], action_callback, None) - -if o.id: - n.props.id = int(o.id) - -if o.close: - n.props.id = int(o.id) - n.close() - sys.exit(0) - -# FIXME hints - -n.set_timeout(int(o.timeout)) - -n.show() - -if o.print_id: - nid = n.props.id - print nid - -# FIXME wait diff --git a/test/test.sh b/test/test.sh index c490675..c560776 100755 --- a/test/test.sh +++ b/test/test.sh @@ -6,20 +6,20 @@ function keypress { } function basic_notifications { - ./notify.py -a "dunst tester" -s "normal" -b "italic body" -u "n" - ./notify.py -a "dunst tester" -s "critical" -b "bold body" -u "c" - ./notify.py -a "dunst tester" -s "long body" -b "This is a notification with a very long body" - ./notify.py -a "dunst tester" -s "duplucate" - ./notify.py -a "dunst tester" -s "duplucate" - ./notify.py -a "dunst tester" -s "duplucate" - ./notify.py -a "dunst tester" -s "url" -b "www.google.de" + ../dunstify -a "dunst tester" "normal" "italic body" + ../dunstify -a "dunst tester" -u c "critical" "bold body" + ../dunstify -a "dunst tester" "long body" "This is a notification with a very long body" + ../dunstify -a "dunst tester" "duplucate" + ../dunstify -a "dunst tester" "duplucate" + ../dunstify -a "dunst tester" "duplucate" + ../dunstify -a "dunst tester" "url" "www.google.de" } function show_age { killall dunst ../dunst -config dunstrc.show_age & - ./notify.py -a "dunst tester" -s "Show Age" -b "These should print their age after 2 seconds" -u "c" + ../dunstify -a "dunst tester" -u c "Show Age" "These should print their age after 2 seconds" basic_notifications keypress } @@ -27,24 +27,26 @@ function show_age { function run_script { killall dunst PATH=".:$PATH" ../dunst -config dunstrc.run_script & - ./notify.py -a "dunst tester" -s "Run Script" -b "After Keypress, 2 other notification should pop up. THis needs notify-send installed" -u "c" + ../dunstify -a "dunst tester" -u c \ + "Run Script" "After Keypress, 2 other notification should pop up. THis needs notify-send installed" keypress - ./notify.py -a "dunst tester" -s "trigger" -b "this should trigger a notification" -u "c" + ../dunstify -a "dunst tester" -u c "trigger" "this should trigger a notification" keypress } function ignore_newline { killall dunst ../dunst -config dunstrc.ignore_newline_no_wrap & - ./notify.py -a "dunst tester" -s "Ignore Newline No Wrap" -b "There should be no newline anywhere" -u "c" - ./notify.py -a "dunst tester" -s "Th\nis\n\n\n is\n fu\nll of \n" -s "\nnew\nlines" -u "c" + ../.dunstify -a "dunst tester" -u c "Ignore Newline No Wrap" "There should be no newline anywhere" + ../.dunstify -a "dunst tester" -u c "Th\nis\n\n\n is\n fu\nll of \n" "\nnew\nlines" basic_notifications keypress killall dunst ../dunst -config dunstrc.ignore_newline & - ./notify.py -a "dunst tester" -s "Ignore Newline" -b "The only newlines you should encounter here are wordwraps. That's why I'm so long." -u "c" - ./notify.py -a "dunst tester" -s "Th\nis\n\n\n is\n fu\nll of \n" -b "\nnew\nlines" -u "c" + ../dunstify -a "dunst tester" -u c "Ignore Newline" \ + "The only newlines you should encounter here are wordwraps. That's why I'm so long." + ../dunstify -a "dunst tester" -u c "Th\nis\n\n\n is\n fu\nll of \n" "\nnew\nlines" basic_notifications keypress } @@ -52,9 +54,9 @@ function ignore_newline { function replace { killall dunst ../dunst -config dunstrc.default & - id=$(./notify.py -a "dunst tester" -s "Replace" -b "this should get replaces after keypress" -p) + id=$(../dunstify -a "dunst tester" -p "Replace" "this should get replaces after keypress") keypress - id=$(./notify.py -a "dunst tester" -s "Success?" -b "I hope this is not a new notification" -r $id) + ../dunstify -a "dunst tester" -r $id "Success?" "I hope this is not a new notification" keypress } @@ -62,16 +64,16 @@ function replace { function markup { killall dunst ../dunst -config dunstrc.markup "200x0+10+10" & - ./notify.py -a "dunst tester" -s "Markup Tests" -u "c" - ./notify.py -a "dunst tester" -s "bold italic" - ./notify.py -a "dunst tester" -s "broken markup" + ../dunstify -a "dunst tester" "Markup Tests" -u "c" + ../dunstify -a "dunst tester" "bold italic" + ../dunstify -a "dunst tester" "broken markup" keypress killall dunst ../dunst -config dunstrc.nomarkup "200x0+10+10" & - ./notify.py -a "dunst tester" -s "NO Markup Tests" -u "c" - ./notify.py -a "dunst tester" -s "bolditalic" - ./notify.py -a "dunst tester" -s "broken markup" + ../dunstify -a "dunst tester" -u c "NO Markup Tests" + ../dunstify -a "dunst tester" "bolditalic" + ../dunstify -a "dunst tester" "broken markup" keypress } @@ -79,25 +81,25 @@ function markup { function corners { killall dunst ../dunst -config dunstrc.default -geom "200x0+10+10" & - ./notify.py -a "dunst tester" -s "upper left" -u "c" + ../dunstify -a "dunst tester" -u c "upper left" basic_notifications keypress killall dunst ../dunst -config dunstrc.default -geom "200x0-10+10" & - ./notify.py -a "dunst tester" -s "upper right" -u "c" + ../dunstify -a "dunst tester" -u c "upper right" basic_notifications keypress killall dunst ../dunst -config dunstrc.default -geom "200x0-10-10" & - ./notify.py -a "dunst tester" -s "lower right" -u "c" + ../dunstify -a "dunst tester" -u c "lower right" basic_notifications keypress killall dunst ../dunst -config dunstrc.default -geom "200x0+10-10" & - ./notify.py -a "dunst tester" -s "lower left" -u "c" + ../dunstify -a "dunst tester" -u c "lower left" basic_notifications keypress @@ -106,44 +108,44 @@ function corners { function geometry { killall dunst ../dunst -config dunstrc.default -geom "0x0" & - ./notify.py -a "dunst tester" -s "0x0" -u "c" + ../dunstify -a "dunst tester" -u c "0x0" basic_notifications keypress killall dunst ../dunst -config dunstrc.default -geom "200x0" & - ./notify.py -a "dunst tester" -s "200x0" -u "c" + ../dunstify -a "dunst tester" -u c "200x0" basic_notifications keypress killall dunst ../dunst -config dunstrc.default -geom "200x2" & - ./notify.py -a "dunst tester" -s "200x2" -u "c" + ../dunstify -a "dunst tester" -u c "200x2" basic_notifications keypress killall dunst ../dunst -config dunstrc.default -geom "200x1" & - ./notify.py -a "dunst tester" -s "200x1" -u "c" + ../dunstify -a "dunst tester" -u c "200x1" basic_notifications keypress killall dunst ../dunst -config dunstrc.default -geom "0x1" & - ./notify.py -a "dunst tester" -s "0x1" -u "c" + ../dunstify -a "dunst tester" -u c "0x1" basic_notifications keypress killall dunst ../dunst -config dunstrc.default -geom "-300x1" & - ./notify.py -a "dunst tester" -s "-300x1" -u "c" + ../dunstify -a "dunst tester" -u c "-300x1" basic_notifications keypress killall dunst ../dunst -config dunstrc.default -geom "-300x1-20-20" & - ./notify.py -a "dunst tester" -s "-300x1-20-20" -u "c" + ../dunstify -a "dunst tester" -u c "-300x1-20-20" basic_notifications keypress } @@ -161,8 +163,6 @@ else ignore_newline replace markup - corners - geometry fi killall dunst