From a92b011530cbfa250700d403b4c706ad0240cd07 Mon Sep 17 00:00:00 2001
From: Saumit Dinesan <justsaumit@protonmail.com>
Date: Mon, 1 Aug 2022 13:06:41 +0530
Subject: sxhkd pidkillall + blank notif correction

---
 .config/sxhkd/sxhkdrc | 4 ++++
 .local/bin/sp         | 0
 .scripts/pidkill      | 6 +++---
 .scripts/pidkillall   | 9 +++++++++
 4 files changed, 16 insertions(+), 3 deletions(-)
 mode change 100644 => 100755 .local/bin/sp
 create mode 100755 .scripts/pidkillall

diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc
index 67b1a9c..2605319 100644
--- a/.config/sxhkd/sxhkdrc
+++ b/.config/sxhkd/sxhkdrc
@@ -105,6 +105,10 @@ super + d
 super + F1
       pidkill
 
+#dmenu pidkillall
+ctrl + F1
+      pidkillall
+
 #dmenu emoji-picker (universal)
 super + F2
       emojisel
diff --git a/.local/bin/sp b/.local/bin/sp
old mode 100644
new mode 100755
diff --git a/.scripts/pidkill b/.scripts/pidkill
index e75687f..754a610 100755
--- a/.scripts/pidkill
+++ b/.scripts/pidkill
@@ -1,9 +1,9 @@
 #!/bin/sh
 
-prok=$(ps -u $USER -o pid,%mem,%cpu,comm | sort -b -k2 -r | sed -n '1!p' | dmenu -i -l 15 )
+prok=$(ps -u $USER -o pid,%mem,%cpu,comm | sed -n '1!p' | sort -b -k2 -r | 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"
+kill -15 $pid 2>/dev/null &&
+[ -n $pname ] && dunstify "Terminated process Successfully" "$pname was killed"
 
diff --git a/.scripts/pidkillall b/.scripts/pidkillall
new file mode 100755
index 0000000..86fad3c
--- /dev/null
+++ b/.scripts/pidkillall
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+psout=$(ps -u $USER -o pid,%cpu,%mem,comm | sed -n '1!p' | sort -b -k2 -r| cut --characters=1-18 --complement | awk '!x[$0]++'| dmenu -i -l 15  )
+//uniq without piping into sort before with the help of awk
+
+killall $psout 2>/dev/null &&
+[ -n $psout ] && dunstify "Terminated all processes Successfully" "$psout was killed"
+
+
-- 
cgit v1.2.3