#!/bin/sh

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

kill -15 $pid 2>/dev/null
[ -z $pname ] || dunstify "Terminated process Successfully" "$pname was killed"