summaryrefslogtreecommitdiff
path: root/scripts/.local/bin/dkill
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/.local/bin/dkill')
-rwxr-xr-xscripts/.local/bin/dkill24
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/.local/bin/dkill b/scripts/.local/bin/dkill
new file mode 100755
index 0000000..3e0b7ea
--- /dev/null
+++ b/scripts/.local/bin/dkill
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+# dmenu theming
+dmenu="cdmenu"
+lines="-l 30"
+
+selected="$(ps -a -u $USER | \
+ "$dmenu" -i -p "Select process to kill" \
+ $lines | \
+ awk '{print $1" "$4}')";
+
+if [[ ! -z $selected ]]; then
+
+ answer="$(echo -e "Yes\nNo" | \
+ "$dmenu" -i -p "$selected will be killed, are you sure?" \
+ $lines )"
+
+ if [[ $answer == "Yes" ]]; then
+ selpid="$(awk '{print $1}' <<< $selected)";
+ kill -9 $selpid
+ fi
+fi
+
+exit 0