diff --git a/lib/notify_send/notify-action.sh b/lib/notify_send/notify-action.sh index a524813c..114e8385 100755 --- a/lib/notify_send/notify-action.sh +++ b/lib/notify_send/notify-action.sh @@ -14,10 +14,10 @@ ${DEBUG_NOTIFY_SEND:=false} && { } SEND_SH=${0%/*}/notify-send.sh -GDBUS_ARGS=(monitor --session --dest org.freedesktop.Notifications --object-path /org/freedesktop/Notifications) GDBUS_PIDF=${TMP}/${APP_NAME:=${SELF}}.${$}.p +GDBUS_ARGS=(monitor --session --dest org.freedesktop.Notifications --object-path /org/freedesktop/Notifications) -abrt () { echo "${0}: ${@}" >&2 ; exit 1 ; } +abrt () { echo "${SELF}: ${@}" >&2 ; exit 1 ; } # consume the command line typeset -i ID="${1}" ;shift @@ -60,7 +60,7 @@ doit () { ${EXPLICIT_CLOSE:-false} && "${SEND_SH}" -s ${ID} } -# start current monitor +# start the monitor { gdbus ${GDBUS_ARGS[@]} & echo ${!} >> "${GDBUS_PIDF}" } |while IFS=" :.(),'" read x x x x e x i x k x ;do diff --git a/lib/notify_send/notify-send.sh b/lib/notify_send/notify-send.sh index 931a549e..1c00b96a 100755 --- a/lib/notify_send/notify-send.sh +++ b/lib/notify_send/notify-send.sh @@ -49,10 +49,9 @@ BODY= positional=false summary_set=false _r= -set +H -help() { - cat < [BODY] - create a notification @@ -73,24 +72,16 @@ Application Options: -p, --print-id Print the notification ID to the standard output. -r, --replace=ID Replace existing notification. -R, --replace-file=FILE Store and load notification replace ID to/from this file. - -s, --close=ID Close notification. With -R, get ID from -R file. + -s, --close=ID Close notification. With -R, get ID from -R file. -v, --version Version of the package. EOF } -abrt () { echo "${SELF}: $@" >&2 ; exit 1 ; } - -make_hint () { - _r="" ;local t=${1} n=${2} c=${3} - [[ ${t} =~ ^(byte|int32|double|string)$ ]] || abrt "Hint types: byte int32 double string" - [[ ${t} = string ]] && c="\"${3}\"" - _r="\"${n}\": <${t} ${c}>" -} +abrt () { echo "${SELF}: ${@}" >&2 ; exit 1 ; } notify_close () { - typeset -i i=${2} - ((${i}>0)) && sleep ${i:0:-3}.${i:$((${#i}-3))} + i=${2} ;((${i}>0)) && sleep ${i:0:-3}.${i:$((${#i}-3))} gdbus call ${NOTIFY_ARGS[@]} --method org.freedesktop.Notifications.CloseNotification "${1}" >&- } @@ -110,6 +101,13 @@ process_category () { done } +make_hint () { + _r= ;local t=${1} n=${2} c=${3} + [[ ${t} =~ ^(byte|int32|double|string)$ ]] || abrt "Hint types: byte int32 double string" + [[ ${t} = string ]] && c="\"${3}\"" + _r="\"${n}\":<${t} ${c}>" +} + process_hint () { local a ;IFS=: a=(${1}) ((${#a[@]}==3)) || abrt "Hint syntax: \"TYPE:NAME:VALUE\""