From 436a2b9505c420510ac0dba2e53357772541af2b Mon Sep 17 00:00:00 2001 From: Crony Akatsuki Date: Mon, 1 Aug 2022 17:51:24 +0200 Subject: [PATCH] simplified the kill script. --- dmenu-kill | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dmenu-kill b/dmenu-kill index cb22fea..30811e7 100755 --- a/dmenu-kill +++ b/dmenu-kill @@ -4,14 +4,14 @@ source $HOME/.config/dmenu/config -selected=$(ps --user "$USER" -F | $DMENU -p "Select procces to kill:" -l 5 | awk '{print $2" "$11}') +pid=$(ps -u $USER -o pid,%mem,%cpu,comm,cmd | sort -b -k3 -r | dmenu -l 15 -i -p "Choose procces to kill: " | awk '{print $1}') -[ -n "$selected" ] || exit +[ -n "$pid" ] || exit answer=$(printf "yes\\nno" | $DMENU -p "Are you sure?") [ $answer = "yes" ] || exit -kill -9 "${selected%% *}" +kill -15 $pid 2>/dev/null -quick-notify "Killed Procces" "$selected" +quick-notify "Killed Procces" "$pid"