#!/bin/sh

prok=$(ps -u $USER -o pid,%mem,%cpu,comm | sed -n '1!p' | sort -b -k2 -r | dmenu -i -l 15 )
pid=$(echo $prok | awk '{print $1}')
pname=$(echo $prok | awk '{print $4}')

kill -15 $pid 2>/dev/null &&
[ -n "$pname" ] && dunstify "Terminated process Successfully" "$pname was killed" -i skull