diff options
author | aetherised | 2021-11-09 15:20:33 -0500 |
---|---|---|
committer | aetherised | 2021-11-09 15:20:33 -0500 |
commit | 40eba8c25b35dad1154a842c38e1db292b08605d (patch) | |
tree | d8e3dfce5c8fc33d9376b88f0f0fe541979a33f3 | |
parent | 73f768a0f85e95a06804cf0eb6d1b4c1a0a2d373 (diff) | |
download | aur-40eba8c25b35dad1154a842c38e1db292b08605d.tar.gz |
tweak notifications
-rwxr-xr-x | addmag | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -16,6 +16,10 @@ USRRC="${HOME}/.${RCNAME}" ADDR= NOTIFY= +notify() { + [[ -n "${NOTIFY}" ]] && notify-send "${@}" +} + while getopts 'n' arg; do case "${arg}" in n) NOTIFY="true" ;; @@ -27,10 +31,6 @@ shift $((OPTIND - 1)) LINK="${1}" -notify() { - notify-send "${@}" || echo "notification failed" -} - if [[ -z "${LINK}" ]]; then echo "ERROR: no magnet link or torrent file specified" exit 1 @@ -48,9 +48,9 @@ fi if transmission-remote "${ADDR}" -a "${LINK}"; then echo "added '${LINK}' to '${ADDR}'" - [[ -n "${NOTIFY}" ]] && notify -u normal -t 5000 "TORRENT ADDED" "Added torrent to '${ADDR}'" + notify -u normal -t 5000 "TORRENT ADDED" "Added torrent to '${ADDR}'" else echo "ERROR: failed to add '${LINK}' to '${ADDR}'" - [[ -n "${NOTIFY}" ]] && notify -u critical -t 5000 "TORRENT ADD FAILED" "Failed to add torrent to '${ADDR}'" + notify -u critical -t 5000 "TORRENT ADD FAILED" "Failed to add torrent to '${ADDR}'" fi |