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"