From 6e11f434d71a49a6f3dd42d1471eaf7b46003717 Mon Sep 17 00:00:00 2001 From: Jacob McDonnell Date: Wed, 4 Jan 2023 18:37:40 -0500 Subject: updating scripts --- .local/bin/internet | 10 ++++++++++ .local/bin/prompt | 2 ++ .local/bin/weather | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 .local/bin/internet create mode 100755 .local/bin/prompt (limited to '.local/bin') diff --git a/.local/bin/internet b/.local/bin/internet new file mode 100755 index 0000000..70e48ec --- /dev/null +++ b/.local/bin/internet @@ -0,0 +1,10 @@ +#!/bin/sh + +[ "$(connmanctl services | grep "Wired" | awk -F' ' '{print $2}')" = "Wired" ] && CONNECTION="Wired" || CONNECTION="$(connmanctl services | grep '*' | awk -F' ' '{print $2}')" + +[ "$CONNECTION" = "Wired" ] && IP="$(ip address | grep dynamic | grep 192.168.)" || IP="$(ip address | grep wlo | grep 192.168. )" + +IP="${IP%/*}" +IP="${IP##* }" + +printf $CONNECTION diff --git a/.local/bin/prompt b/.local/bin/prompt new file mode 100755 index 0000000..52f8af3 --- /dev/null +++ b/.local/bin/prompt @@ -0,0 +1,2 @@ +#!/bin/sh +[ "$(printf "No\\nYes" | dmenu -i -p "$1" -nb darkred -sb red -sf white -nf gray )" = "Yes" ] && $2 diff --git a/.local/bin/weather b/.local/bin/weather index 000ba1b..a52a855 100755 --- a/.local/bin/weather +++ b/.local/bin/weather @@ -4,7 +4,7 @@ getforecast() { ping -q -c 1 1.1.1.1 >/dev/null || exit 1 curl -sf "wttr.in/Ocean+City" > "$HOME/.cache/weatherreport" || exit 1 ;} showweather() { printf "%s" "$(sed '16q;d' "$HOME/.cache/weatherreport" | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g" | tr -d '\n')" -sed '13q;d' "$HOME/.cache/weatherreport" | grep -o "m\\(-+\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " ❄️",$1 "°","🌞",$2 "°"}' ;} +sed '13q;d' "$HOME/.cache/weatherreport" | grep -o "m\\(-+\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print "❄️",$1 "°","🌞",$2 "°"}' ;} [ "$(stat -c %y "$HOME/.cache/weatherreport" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && getforecast showweather -- cgit v1.2.3