diff options
-rwxr-xr-x | 1337x | 6 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rwxr-xr-x | damb | 8 | ||||
-rwxr-xr-x | dbook | 12 | ||||
-rwxr-xr-x | dpass | 19 | ||||
-rwxr-xr-x | pirowatch | 18 | ||||
-rwxr-xr-x | vpn | 6 | ||||
-rwxr-xr-x | wip | 2 | ||||
-rwxr-xr-x | yts | 8 |
9 files changed, 44 insertions, 37 deletions
@@ -9,7 +9,7 @@ die() : "${1:?}" command -v notify-send > /dev/null && - notify-send " 1337x" "$1" + notify-send " 1337x" "$1" printf "\033[31;1merr: %b\033[0m\n" "$1" exit "${2:-1}" @@ -72,12 +72,12 @@ main() curl -Is "$url_1337x" > /dev/null || url_1337x="$proxy_1337x" - query="${*:-$(printf "" | "$menu" -p " ")}" + query="${*:-$(printf "" | "$menu" -p " ")}" [ -z "$query" ] && die "please enter a query" fetch="$(search_1337x "$query")" - select="$(echo "$fetch" | sed -e's/^.*\///g' | tr '-' ' ' | "$menu" -l 25 -p " " | tr ' ' '-')" + select="$(echo "$fetch" | sed -e's/^.*\///g' | tr '-' ' ' | "$menu" -l 25 -p " " | tr ' ' '-')" magnet="$(magnet_1337x "$(echo "$fetch" | grep "$select")")" [ -z "$magnet" ] && @@ -3,7 +3,7 @@ [suckless](https://suckless.org/) community. this is my collection of posix scripts for dmenu like programs. these scipts were initially made for dmenu with xorg in mind, now they work on both xorg and wayland using dmenu and wmenu respectively. these -scripts might use [nerd fonts](https://www.nerdfonts.com/), make sure you've installed them for the best +scripts might use font awesome, make sure you've installed them for the best experience. you can find more info about them below. ## dbook @@ -11,7 +11,7 @@ die() : "${1:?}" command -v notify-send > /dev/null && - notify-send " damb" "$1" + notify-send " damb" "$1" printf "\033[31;1merr: %b\033[0m\n" "$1" exit "${2:-1}" @@ -31,7 +31,7 @@ dep_check() get_opt() { - printf "select\nlinks\nrandom\nstream\nstop" | "$menu" -p "הּ " + printf "select\nlinks\nrandom\nstream\nstop" | "$menu" -p " " } get_ambs() @@ -42,7 +42,7 @@ get_ambs() get_link() { grep -v "^#.*$" "$config_dir"/links | - grep "$(grep -v "^#.*$" "$config_dir"/links | cut -d '=' -f1 | "$menu" -p " " -l 25)" | + grep "$(grep -v "^#.*$" "$config_dir"/links | cut -d '=' -f1 | "$menu" -p " " -l 25)" | cut -d '=' -f2 | tr -d ' ' } @@ -56,7 +56,7 @@ main() case "$(get_opt)" in select) dep_check "ffplay" - ffplay -volume 20 -nodisp -loop 0 "$amb_dir/$(get_ambs | "$menu" -p " " -l 25)" & + ffplay -volume 20 -nodisp -loop 0 "$amb_dir/$(get_ambs | "$menu" -p " " -l 25)" & echo "$!" >> "$pid_file" ;; links) @@ -9,7 +9,7 @@ note() : "${1:?}" command -v notify-send > /dev/null && - notify-send " dbook" "$1" + notify-send " dbook" "$1" } die() @@ -141,7 +141,7 @@ rm_data() entry() { - printf "" | "$menu" -p " ${1:?} " || + printf "" | "$menu" -p " ${1:?} " || die "input empty" } @@ -252,11 +252,11 @@ main() printf "%s\t|\t%s\n" "$name" "$data" >> "$book_conf" ;; -d) - rm_data "${2:-"$(parse_name | "$menu" -p " " -l 25)"}" + rm_data "${2:-"$(parse_name | "$menu" -p " " -l 25)"}" ;; -t) shift > /dev/null 2>&1 - data="${*:-"$(parse_name | "$menu" -p " " -l 25 | parse_data)"}" + data="${*:-"$(parse_name | "$menu" -p " " -l 25 | parse_data)"}" [ -z "$data" ] && die "empty, use -i to add an entry" @@ -271,7 +271,7 @@ main() ;; -c) shift > /dev/null 2>&1 - data="${*:-"$(parse_name | "$menu" -p " " -l 25 | parse_data)"}" + data="${*:-"$(parse_name | "$menu" -p " " -l 25 | parse_data)"}" [ -z "$data" ] && die "empty, use -i to add an entry" @@ -290,7 +290,7 @@ main() "") dep_check "xdg-open" - data="$(parse_name | "$menu" -p " " -l 25 | parse_data)" + data="$(parse_name | "$menu" -p " " -l 25 | parse_data)" [ -z "$data" ] && die "empty, use -i to add an entry" @@ -3,12 +3,19 @@ pass_store_dir="${PASSWORD_STORE_DIR:-$HOME/.pass}" menu="wmenu" -die() +note() { : "${1:?}" command -v notify-send > /dev/null && - notify-send " dpass" "$1" + notify-send " dpass" "$1" +} + +die() +{ + : "${1:?}" + + note "$1" printf "\033[31;1merr: %b\033[0m\n" "$1" exit "${2:-1}" @@ -26,14 +33,6 @@ dep_check() unset dep } -note() -{ - : "${1:?}" - - command -v notify-send > /dev/null && - notify-send " dpass" "$1" -} - search() { # usage: search directory @@ -8,13 +8,21 @@ torrent_port=49110 dht_port=49130 menu="wmenu" +note() +{ + # usage: note "message" + : "${1:?}" + + command -v "notify-send" 1>/dev/null && + notify-send " pirowatch" "$1" +} + die() { # usage: die "reason" [exit_status] : "${1:?}" - command -v "notify-send" 1>/dev/null && - notify-send " pirowatch" "$1" + note "$1" printf "\033[31;1merr: %b\033[0m\n" "$1" exit "${2:-1}" @@ -40,7 +48,7 @@ stream() { dep_check "webtorrent" "mpv" command -v "notify-send" 1>/dev/null && - notify-send " connecting to peers" "wait for few seconds" + note "connecting to peers, wait for few seconds" if [ -n "$2" ] then @@ -63,7 +71,7 @@ set_index() { grep -Ei "\.(mkv|mp4|webm|avi|mov|flv|flac|opus|ogg|mp3|wav) (.*)$") if [ "$(echo "$fetch" | wc -l)" -gt 1 ] then - fetch="$(printf "%s" "$fetch" | "$menu" -p " " -l 25)" || + fetch="$(printf "%s" "$fetch" | "$menu" -p " " -l 25)" || die "empty selection" 66 fi @@ -87,7 +95,7 @@ main() dep_check "$menu" - torrent="${1:-$torrent_dir/$(find "$torrent_dir" -type f -name "*.torrent" | sed 's/.*\///g' | "$menu" -p " " -l 25)}" + torrent="${1:-$torrent_dir/$(find "$torrent_dir" -type f -name "*.torrent" | sed 's/.*\///g' | "$menu" -p " " -l 25)}" [ -z "${torrent##"${torrent_dir}"/}" ] && die "magnet or torrent file not entered" 66 [ -d "$cache_dir" ] || @@ -3,7 +3,7 @@ note() { command -v notify-send > /dev/null && - notify-send "撚 vpn" "$1" + notify-send " vpn" "$1" printf "\n%s\n" "$1" } @@ -14,10 +14,10 @@ main() if ip -details link show "$wg_conf" 2> /dev/null | grep --quiet "wireguard" then - sudo -A -p "撚 halt vpn: " wg-quick down "$wg_conf" && + sudo -A -p " halt, authentication required: " wg-quick down "$wg_conf" && note "connection was dropped" else - sudo -A -p "撚 initialize vpn: " wg-quick up "$wg_conf" && + sudo -A -p " init, authentication required: " wg-quick up "$wg_conf" && note "traffic routed through $wg_conf" fi @@ -5,5 +5,5 @@ current_ip=$(dig +short myip.opendns.com @208.67.222.222) geo_loc_ip=$(geoiplookup "$current_ip" | grep -v "Country" | sed 's/^.*: //g') command -v "notify-send" 1>/dev/null && - notify-send " $current_ip" "$geo_loc_ip" + notify-send " $current_ip" "$geo_loc_ip" printf "ipv4: %s\n%s\n" "$current_ip" "$geo_loc_ip" @@ -9,7 +9,7 @@ die() : "${1:?}" command -v notify-send > /dev/null && - notify-send " yts" "$1" + notify-send " yts" "$1" printf "\033[31;1merr: %b\033[0m\n" "$1" exit "${2:-1}" @@ -51,7 +51,7 @@ dllink_yts() id= fetch="$(get_yts "movies/$1" | grep -Eo "value=\"[A-Z0-9]{40}\">[a-zA-Z0-9 ]*")" - select="$(echo "$fetch" | cut -d'>' -f2 | "$menu" -l 25 -p " ")" + select="$(echo "$fetch" | cut -d'>' -f2 | "$menu" -l 25 -p " ")" [ -z "$select" ] && die "please select a quality" id="$(echo "$fetch" | grep "$select" | cut -d'"' -f2)" @@ -79,7 +79,7 @@ main() dep_check "$menu" - query="${*:-$(printf "" | "$menu" -p " ")}" + query="${*:-$(printf "" | "$menu" -p " ")}" [ -z "$query" ] && die "please enter a query" @@ -87,7 +87,7 @@ main() url_yts="$proxy_yts" fetch="$(search_yts "$query")" - dllink="$(dllink_yts "$(echo "$fetch" | tr '-' ' ' | "$menu" -l 25 -p " " | tr ' ' '-')")" + dllink="$(dllink_yts "$(echo "$fetch" | tr '-' ' ' | "$menu" -l 25 -p " " | tr ' ' '-')")" [ -z "$dllink" ] && die "empty magnet" |