dmenu-scripts/dmenu-kill

26 lines
426 B
Plaintext
Raw Normal View History

2022-03-21 18:05:05 +01:00
#!/bin/sh
2022-04-05 16:59:13 +02:00
# kill those pesky proceses
2023-11-04 22:03:43 +01:00
load_config() {
. $HOME/.config/dmenu/config
}
2022-07-17 11:03:13 +02:00
2023-11-04 22:03:43 +01:00
main() {
load_config
2022-03-21 18:05:05 +01:00
2023-11-04 22:03:43 +01:00
pid=$(ps -e -o pid,%mem,%cpu,comm,cmd | sort -b -k3 -r | $DMENU -l 15 -i -p "Choose procces to kill: " | awk '{print $1}')
2022-03-21 18:05:05 +01:00
2023-11-04 22:03:43 +01:00
[ -n "$pid" ] || exit
2022-03-21 18:05:05 +01:00
2023-11-04 22:03:43 +01:00
answer=$(printf "yes\\nno" | $DMENU -p "Are you sure?")
2022-03-21 18:05:05 +01:00
2023-11-04 22:03:43 +01:00
[ $answer = "yes" ] || exit
2022-03-21 18:05:05 +01:00
2023-11-04 22:03:43 +01:00
kill -15 $pid 2>/dev/null
2023-11-04 22:03:43 +01:00
quick-notify "Killed Procces" "$pid"
}
main $@