FollieHiyuki-dotfiles/home/.local/bin/killmenu
2021-02-13 19:28:59 +03:00

34 lines
506 B
Bash
Executable File

#!/bin/bash
case $1 in
--bemenu)
menu="bemenu -i -p kill -l 10"
;;
--dmenu)
menu="dmenu -i -p kill -l 10"
;;
--fzf)
menu="fzf --multi"
;;
--wofi)
menu="wofi -d -i -p kill"
;;
--rofi)
menu="rofi -dmenu -p kill"
;;
*)
exit
;;
esac
if [ "$UID" != "0" ]; then
pid=$(ps -f -u $UID | sed 1d | ${menu} | awk '{print $2}')
else
pid=$(ps -ef | sed 1d | ${menu} | awk '{print $2}')
fi
if [ "x$pid" != "x" ]
then
echo $pid | xargs kill -${1:-9}
fi