Made scripts more readable by moving most logic to functions.
This commit is contained in:
parent
86e3a3a79c
commit
5c738fdc77
11 changed files with 234 additions and 133 deletions
22
dmenu-kill
22
dmenu-kill
|
@ -2,16 +2,24 @@
|
|||
|
||||
# kill those pesky proceses
|
||||
|
||||
. $HOME/.config/dmenu/config
|
||||
load_config () {
|
||||
. $HOME/.config/dmenu/config
|
||||
}
|
||||
|
||||
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}')
|
||||
main () {
|
||||
load_config
|
||||
|
||||
[ -n "$pid" ] || exit
|
||||
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}')
|
||||
|
||||
answer=$(printf "yes\\nno" | $DMENU -p "Are you sure?")
|
||||
[ -n "$pid" ] || exit
|
||||
|
||||
[ $answer = "yes" ] || exit
|
||||
answer=$(printf "yes\\nno" | $DMENU -p "Are you sure?")
|
||||
|
||||
kill -15 $pid 2>/dev/null
|
||||
[ $answer = "yes" ] || exit
|
||||
|
||||
quick-notify "Killed Procces" "$pid"
|
||||
kill -15 $pid 2>/dev/null
|
||||
|
||||
quick-notify "Killed Procces" "$pid"
|
||||
}
|
||||
|
||||
main $@
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue