diff options
Diffstat (limited to 'bin/task/context')
-rwxr-xr-x | bin/task/context | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/task/context b/bin/task/context index 1f1dbda..358c548 100755 --- a/bin/task/context +++ b/bin/task/context | |||
@@ -69,7 +69,13 @@ _save_spend_time_to_dic() { | |||
69 | } | 69 | } |
70 | 70 | ||
71 | _desktop_notify() { | 71 | _desktop_notify() { |
72 | which notify-send &>/dev/null && notify-send "$context +$1" | 72 | which notify-send &>/dev/null || return 1 |
73 | if [[ "$1" =~ ^[+-] ]]; then | ||
74 | local time="$1" | ||
75 | else | ||
76 | local time=+"$1" | ||
77 | fi | ||
78 | notify-send "$context $time" | ||
73 | } | 79 | } |
74 | 80 | ||
75 | # Update spend time on current context | 81 | # Update spend time on current context |
@@ -80,7 +86,7 @@ _update_spend_time() { | |||
80 | fi | 86 | fi |
81 | 87 | ||
82 | given_seconds="$(_get_seconds "$time")" | 88 | given_seconds="$(_get_seconds "$time")" |
83 | _desktop_notify "$(_format_seconds "${given_seconds}")" | 89 | _desktop_notify "$time" |
84 | 90 | ||
85 | echo -e "$(date +'%Y%m%d %H:%M:%S')\t$context\t${given_seconds}" >>$LOG_FILE | 91 | echo -e "$(date +'%Y%m%d %H:%M:%S')\t$context\t${given_seconds}" >>$LOG_FILE |
86 | } | 92 | } |