From 4387ee91cf388be1a2769755c5993e1f35497602 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Mon, 20 Mar 2023 17:12:40 +0530 Subject: font: switch to font awesome for icons --- 1337x | 6 +++--- README.md | 2 +- damb | 8 ++++---- dbook | 12 ++++++------ dpass | 19 +++++++++---------- pirowatch | 18 +++++++++++++----- vpn | 6 +++--- wip | 2 +- yts | 8 ++++---- 9 files changed, 44 insertions(+), 37 deletions(-) diff --git a/1337x b/1337x index 04254a7..e3f4e4d 100755 --- a/1337x +++ b/1337x @@ -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" ] && diff --git a/README.md b/README.md index 05f54cd..c42b3ea 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/damb b/damb index f8f68b9..737e720 100755 --- a/damb +++ b/damb @@ -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) diff --git a/dbook b/dbook index 487011e..758f646 100755 --- a/dbook +++ b/dbook @@ -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" diff --git a/dpass b/dpass index e1592b2..99654b2 100755 --- a/dpass +++ b/dpass @@ -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 diff --git a/pirowatch b/pirowatch index d5e7d0d..9ac6eae 100755 --- a/pirowatch +++ b/pirowatch @@ -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" ] || diff --git a/vpn b/vpn index 6d5d7fe..b22667f 100755 --- a/vpn +++ b/vpn @@ -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 diff --git a/wip b/wip index 62e2718..4eb2f95 100755 --- a/wip +++ b/wip @@ -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" diff --git a/yts b/yts index 079c628..38ae681 100755 --- a/yts +++ b/yts @@ -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" -- cgit v1.2.3