From 98bbe7bd7fcec209e2408ff0b086858715ca89e0 Mon Sep 17 00:00:00 2001 From: justsaumit Date: Tue, 1 Mar 2022 19:54:04 +0530 Subject: updated --- scripts/dprompt | 9 +++++++++ scripts/pidkill | 9 +++++++++ scripts/prompt | 9 --------- scripts/promptquit | 9 --------- scripts/st-copyout | 1 + scripts/st-urlhandler | 1 + scripts/trashy | 5 +++++ scripts/urbandictserch | 15 +++++++++++++++ scripts/wifi-menu-custom | 22 ++++++++++++++++++++++ scripts/ytd | 2 ++ scripts/ytm | 3 +++ 11 files changed, 67 insertions(+), 18 deletions(-) create mode 100755 scripts/dprompt create mode 100755 scripts/pidkill delete mode 100755 scripts/prompt delete mode 100644 scripts/promptquit create mode 120000 scripts/st-copyout create mode 120000 scripts/st-urlhandler create mode 100755 scripts/trashy create mode 100755 scripts/urbandictserch create mode 100755 scripts/wifi-menu-custom create mode 100755 scripts/ytd create mode 100755 scripts/ytm diff --git a/scripts/dprompt b/scripts/dprompt new file mode 100755 index 0000000..9549658 --- /dev/null +++ b/scripts/dprompt @@ -0,0 +1,9 @@ +#!/bin/sh +# A dmenu binary prompt script +# Gives dmenu prompt labeled with $1 to perform command $2 +# For example: +# './promptquit "Do you really want to quit?" "shutdown -h now"' + +[ $(echo -e "No\nYes" | dmenu -i -p "$1") \ + == "Yes" ] && $2 + diff --git a/scripts/pidkill b/scripts/pidkill new file mode 100755 index 0000000..e1b69e8 --- /dev/null +++ b/scripts/pidkill @@ -0,0 +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 ) +pid=$(echo $prok | awk '{print $1}') +pname=$(echo $prok | awk '{print $4}') + +kill -15 $pid 2>/dev/null +dunstify "Terminated process Successfully" "$pname was killed" + diff --git a/scripts/prompt b/scripts/prompt deleted file mode 100755 index 9549658..0000000 --- a/scripts/prompt +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -# A dmenu binary prompt script -# Gives dmenu prompt labeled with $1 to perform command $2 -# For example: -# './promptquit "Do you really want to quit?" "shutdown -h now"' - -[ $(echo -e "No\nYes" | dmenu -i -p "$1") \ - == "Yes" ] && $2 - diff --git a/scripts/promptquit b/scripts/promptquit deleted file mode 100644 index cb06659..0000000 --- a/scripts/promptquit +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -# A dmenu binary prompt script -# Gives dmenu prompt labeled with $1 to perform command $2 -# For example: -# './promptquit "Do you really want to quit?" "shutdown -h now"' - -[ $(echo -e "No\nYes" | dmenu -i -p "$1") \ - == "Yes"] && $2 - diff --git a/scripts/st-copyout b/scripts/st-copyout new file mode 120000 index 0000000..e822e4a --- /dev/null +++ b/scripts/st-copyout @@ -0,0 +1 @@ +/home/saumit/.local/src/st/external-pipe_scripts/st-copyout \ No newline at end of file diff --git a/scripts/st-urlhandler b/scripts/st-urlhandler new file mode 120000 index 0000000..0d8625f --- /dev/null +++ b/scripts/st-urlhandler @@ -0,0 +1 @@ +/home/saumit/.local/src/st/external-pipe_scripts/st-urlhandler \ No newline at end of file diff --git a/scripts/trashy b/scripts/trashy new file mode 100755 index 0000000..3318e41 --- /dev/null +++ b/scripts/trashy @@ -0,0 +1,5 @@ +#!/bin/sh + +trashfiledir=$(find $HOME -type f -o -type d | dmenu -i -p "File to be deleted:" -l 15| awk '{printf('\"%s\"\n', $0);}') + +trash-put $trashfiledir diff --git a/scripts/urbandictserch b/scripts/urbandictserch new file mode 100755 index 0000000..c007d60 --- /dev/null +++ b/scripts/urbandictserch @@ -0,0 +1,15 @@ +#!/bin/sh + +search=$(echo "" | dmenu -p 'Urban Dictionary:'|sed 's/ /%20/g') + +curl -s "https://api.urbandictionary.com/v0/define?term={$search}" | jq '.' | grep --color=always definition | awk 'BEGIN {RS="definition"; ORS=""} {print $0""++i}' > /tmp/urban-dic + +n=$(wc -l < /tmp/urban-dic) +touch /tmp/urban-dic.txt && > /tmp/urban-dic.txt + +for i in $(eval echo {1..$n}p) +do + sed -n $i /tmp/urban-dic|sed -r "s/\x1B\[[0-9;]*[a-zA-Z]//g" >> /tmp/urban-dic.txt +done +cat /tmp/urban-dic.txt | dmenu -l $n -p "$1"i + diff --git a/scripts/wifi-menu-custom b/scripts/wifi-menu-custom new file mode 100755 index 0000000..db2fced --- /dev/null +++ b/scripts/wifi-menu-custom @@ -0,0 +1,22 @@ +#!/bin/sh + +choice=$(echo -e "up\ndown\nconnect" | dmenu -p "Do you wish to connect to a wi-fi or disconnect?:") + +case $choice in + "connect") + bssid=$(nmcli device wifi list | sed -n '1!p' | cut -b 9- | dmenu -p "Select Wifi  " -l 20 | cut -d' ' -f1) + pass=$(echo "" | dmenu -p "Enter Pswd  ") + nmcli device wifi $choice $bssid password $pass;; + "up" | "down") + ssid=$(nmcli device wifi list | sed -n '1!p' | cut -b 9- | dmenu -p "Select Wifi  " -l 20 | cut -d' ' -f3) + nmcli c $choice $ssid;; +esac +wifistatus=$(nmcli d | grep wlan0 | cut -d ' ' -f10) +case $wifistatus in + "connected") + nmcli con down eth0 "Wired connection 1";; + "disconnected") + nmcli con up eth0 "Wired connection 1";; +esac +ethstatus=$(nmcli d | grep eth0 | cut -d ' ' -f7) +notify-send "Ethernet connection is $ethstatus" diff --git a/scripts/ytd b/scripts/ytd new file mode 100755 index 0000000..a61e490 --- /dev/null +++ b/scripts/ytd @@ -0,0 +1,2 @@ +#!/bin/sh +ytfzf -D diff --git a/scripts/ytm b/scripts/ytm new file mode 100755 index 0000000..ea9a8b0 --- /dev/null +++ b/scripts/ytm @@ -0,0 +1,3 @@ +#!/bin/sh + +ytfzf -mlD -- cgit v1.2.3