diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2018-05-27 08:02:39 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2018-05-27 08:02:39 -0300 |
commit | e0b9d93101a679a9eed199d0b266622285013216 (patch) | |
tree | 4a3b348f95f4f3724839c897dd8b8e4c9602f4ef /xalarm | |
parent | 66519702fc77702216aad6a86076918660373cd9 (diff) | |
download | utils-x11-e0b9d93101a679a9eed199d0b266622285013216.tar.gz utils-x11-e0b9d93101a679a9eed199d0b266622285013216.tar.bz2 |
Adds pause and resume actions
Diffstat (limited to 'xalarm')
-rwxr-xr-x | xalarm | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -51,6 +51,32 @@ function xalarm_cancel { fi } +# Pause alarms +function xalarm_pause { + if [ ! -z "$1" ]; then + if xalarm_list | awk '{ print $1 }' | grep -q "^$1"; then + kill -CONT $1 + fi + else + for pid in `xalarm_list | awk '{ print $1 }'`; do + kill -CONT $pid + done + fi +} + +# Resume alarms +function xalarm_resume { + if [ ! -z "$1" ]; then + if xalarm_list | awk '{ print $1 }' | grep -q "^$1"; then + kill -CONT $1 + fi + else + for pid in `xalarm_list | awk '{ print $1 }'`; do + kill -CONT $pid + done + fi +} + # Usage function xalarm_usage { echo "usage: $BASENAME [list|cancel|kill|help|usage|loop] [timedef] [message]" @@ -62,6 +88,10 @@ if [ "$1" == "list" ]; then xalarm_list elif [ "$1" == "cancel" ] || [ "$1" == "kill" ]; then xalarm_cancel $2 +elif [ "$1" == "pause" ]; then + xalarm_pause $2 +elif [ "$1" == "resume" ]; then + xalarm_resume $2 elif [ "$1" == "help" ] || [ "$1" == "usage" ]; then xalarm_usage elif [ "$1" == "loop" ]; then |