summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAyush Agarwal <ayushnix@fastmail.com>2022-03-02 07:15:53 +0530
committerAyush Agarwal <ayushnix@fastmail.com>2022-03-02 07:15:53 +0530
commit0e8b75ec88facd50a26c1ee165d4e5c7e0c43fbe (patch)
treedbbf2e0911d9fd514d3ca80807b638b57e4a51f7
parent2a17c6160c4a109220f2f918454854d52d696234 (diff)
fix: if sleep is terminated, terminate the pgrp
This embarrasing bug escaped my notice until #21 was raised and I tried to make the clipboard clearing behavior saner. `kill` is a bash built-in and `kill 0` sends the default SIGTERM signal to all processes in the same process group (PGID). If `sleep $tsn_cliptime` is killed for any reason, `kill 0` should end up killing `wl-copy` as well. This can be confirmed by manually sending a SIGTERM to the sleep process.
-rwxr-xr-xtessen2
1 files changed, 1 insertions, 1 deletions
diff --git a/tessen b/tessen
index 5caf939..98886d7 100755
--- a/tessen
+++ b/tessen
@@ -479,7 +479,7 @@ wld_copy() {
"Copied username to clipboard. Will clear in $tsn_cliptime seconds."
fi
{
- sleep "$tsn_cliptime" || exit 1
+ sleep "$tsn_cliptime" || kill 0
wl-copy --clear
} > /dev/null 2>&1 &