aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2023-04-13 08:49:22 +0800
committerHsieh Chin Fan <pham@topo.tw>2023-04-13 08:49:22 +0800
commit51122991d869b0121c0580befa72c14675ae4d65 (patch)
tree45603ffff20d2ffbb22472252cb7809e327033ee
parent27a7b15d1fa485602edeff6f7d44a4e4879b52fd (diff)
Update
-rwxr-xr-xbin/task/context8
1 files changed, 2 insertions, 6 deletions
diff --git a/bin/task/context b/bin/task/context
index 0c22ed3..06848d6 100755
--- a/bin/task/context
+++ b/bin/task/context
@@ -57,7 +57,7 @@ _save_spend_time_to_dic() {
57} 57}
58 58
59_desktop_notify() { 59_desktop_notify() {
60 which notify-send &>/dev/null && notify-send "$context +$time" 60 which notify-send &>/dev/null && notify-send "$context +$1"
61} 61}
62 62
63# Update spend time on current context 63# Update spend time on current context
@@ -68,9 +68,7 @@ _update_spend_time() {
68 fi 68 fi
69 69
70 given_seconds="$(_get_seconds "$time")" 70 given_seconds="$(_get_seconds "$time")"
71 71 _desktop_notify "$(_format_seconds "${given_seconds}")"
72 date >>/tmp/context
73 echo "$given_seconds" >>/tmp/context
74 72
75 # Get total time of given time and current context time 73 # Get total time of given time and current context time
76 while read -r ctx sec; do 74 while read -r ctx sec; do
@@ -81,7 +79,6 @@ _update_spend_time() {
81 break 79 break
82 else 80 else
83 sed -i -E "s/^${context}.*/${context}\t${total}/" $LOG_FILE 81 sed -i -E "s/^${context}.*/${context}\t${total}/" $LOG_FILE
84 _desktop_notify "$(_format_seconds ${total})"
85 exit 0 82 exit 0
86 fi 83 fi
87 fi 84 fi
@@ -89,7 +86,6 @@ _update_spend_time() {
89 done <"$LOG_FILE" 86 done <"$LOG_FILE"
90 87
91 echo -e "$context\t${given_seconds}" >>$LOG_FILE 88 echo -e "$context\t${given_seconds}" >>$LOG_FILE
92 _desktop_notify "$(_format_seconds "${given_seconds}")"
93} 89}
94 90
95# Print spend for each context 91# Print spend for each context