summary refs log tree commit diff
diff options
context:
space:
mode:
-rwxr-xr-xbin/swkill5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/swkill b/bin/swkill
index 9a4a9ab..3ca2e3f 100755
--- a/bin/swkill
+++ b/bin/swkill
@@ -25,12 +25,13 @@ if [ -z "$sel" ]; then
 	sel="current workspace"
 fi
 
-swq "$sel" | jq '.. | select(.pid?) | .name'
+_cons=$(swq $sel | jq '[ .. | select(.pid?) | { name: .name, pid: .pid } ]')
 
 if [ -z "$noninteractive" ]; then
+	printf "${_cons}" | jq '.[].name'
 	{ sleep 10 && kill $$; } &
 	printf "kill? (you have 10s) "
 	read -r
 fi
 
-swq "$sel" | jq '.. | select(.pid?) | .pid' | xargs kill
+printf "${_cons}" | jq '.[].pid' | xargs kill