mirror of
https://github.com/ksyasuda/rice.git
synced 2025-12-05 20:53:38 -08:00
update stuff
This commit is contained in:
@@ -2,24 +2,24 @@
|
||||
|
||||
get_icon() {
|
||||
case $1 in
|
||||
# Icons for weather-icons
|
||||
01d) icon="";;
|
||||
01n) icon="";;
|
||||
02d) icon="";;
|
||||
02n) icon="";;
|
||||
03*) icon="";;
|
||||
04*) icon="";;
|
||||
09d) icon="";;
|
||||
09n) icon="";;
|
||||
10d) icon="";;
|
||||
10n) icon="";;
|
||||
11d) icon="";;
|
||||
11n) icon="";;
|
||||
13d) icon="";;
|
||||
13n) icon="";;
|
||||
50d) icon="";;
|
||||
50n) icon="";;
|
||||
*) icon="";
|
||||
# Icons for weather-icons
|
||||
01d) icon="" ;;
|
||||
01n) icon="" ;;
|
||||
02d) icon="" ;;
|
||||
02n) icon="" ;;
|
||||
03*) icon="" ;;
|
||||
04*) icon="" ;;
|
||||
09d) icon="" ;;
|
||||
09n) icon="" ;;
|
||||
10d) icon="" ;;
|
||||
10n) icon="" ;;
|
||||
11d) icon="" ;;
|
||||
11n) icon="" ;;
|
||||
13d) icon="" ;;
|
||||
13n) icon="" ;;
|
||||
50d) icon="" ;;
|
||||
50n) icon="" ;;
|
||||
*) icon="" ;;
|
||||
|
||||
# Icons for Font Awesome 5 Pro
|
||||
# 01d) icon="";;
|
||||
@@ -46,15 +46,15 @@ get_duration() {
|
||||
osname=$(uname -s)
|
||||
|
||||
case $osname in
|
||||
*BSD) date -r "$1" -u +%H:%M;;
|
||||
*) date --date="@$1" -u +%H:%M;;
|
||||
*BSD) date -r "$1" -u +%H:%M ;;
|
||||
*) date --date="@$1" -u +%H:%M ;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
KEY="6865df0d489817348e4c7941aaa6cdeb"
|
||||
# CITY="Ann Arbor"
|
||||
CITY="Los Angeles"
|
||||
CITY="Los%20Angeles"
|
||||
UNITS="imperial"
|
||||
SYMBOL="°"
|
||||
|
||||
@@ -66,9 +66,9 @@ if [ -n "$CITY" ]; then
|
||||
else
|
||||
CITY_PARAM="q=$CITY"
|
||||
fi
|
||||
|
||||
current=$(curl -sf "$API/weather?appid=$KEY&$CITY_PARAM&units=$UNITS")
|
||||
forecast=$(curl -sf "$API/forecast?appid=$KEY&$CITY_PARAM&units=$UNITS&cnt=1")
|
||||
# echo "$current | $forecast"
|
||||
else
|
||||
location=$(curl -sf https://location.services.mozilla.com/v1/geolocate?key=geoclue)
|
||||
|
||||
@@ -88,7 +88,6 @@ if [ -n "$current" ] && [ -n "$forecast" ]; then
|
||||
forecast_temp=$(echo "$forecast" | jq ".list[].main.temp" | cut -d "." -f 1)
|
||||
forecast_icon=$(echo "$forecast" | jq -r ".list[].weather[0].icon")
|
||||
|
||||
|
||||
if [ "$current_temp" -gt "$forecast_temp" ]; then
|
||||
trend=""
|
||||
elif [ "$forecast_temp" -gt "$current_temp" ]; then
|
||||
@@ -97,7 +96,6 @@ if [ -n "$current" ] && [ -n "$forecast" ]; then
|
||||
trend=""
|
||||
fi
|
||||
|
||||
|
||||
sun_rise=$(echo "$current" | jq ".sys.sunrise")
|
||||
sun_set=$(echo "$current" | jq ".sys.sunset")
|
||||
now=$(date +%s)
|
||||
@@ -107,11 +105,11 @@ if [ -n "$current" ] && [ -n "$forecast" ]; then
|
||||
now2_symbol=""
|
||||
|
||||
if [ "$sun_rise" -gt "$now" ]; then
|
||||
daytime=" $(get_duration "$((sun_rise-now))")"
|
||||
daytime=" $(get_duration "$((sun_rise - now))")"
|
||||
elif [ "$sun_set" -gt "$now" ]; then
|
||||
daytime=" $(get_duration "$((sun_set-now))")"
|
||||
daytime=" $(get_duration "$((sun_set - now))")"
|
||||
else
|
||||
daytime=" $(get_duration "$((sun_rise-now))")"
|
||||
daytime=" $(get_duration "$((sun_rise - now))")"
|
||||
fi
|
||||
|
||||
# WITH TREND AND DAYTIME
|
||||
|
||||
@@ -11,7 +11,9 @@ ARGS=(
|
||||
"Quit"
|
||||
)
|
||||
|
||||
CHOICE=$(printf "%s\n" "${ARGS[@]}" | rofi -config ~/SudacodeRice/rofi/rofidmenu.rasi -dmenu -l 5 -i -p "SSH Helper")
|
||||
CHOICE=$(
|
||||
printf "%s\n" "${ARGS[@]}" | rofi -config ~/SudacodeRice/rofi/flat-orange.rasi -dmenu -l 5 -i -p "SSH Helper"
|
||||
)
|
||||
|
||||
if [[ "$CHOICE" == "Quit" ]]; then
|
||||
printf "%s\n" "NICE" && exit 1
|
||||
|
||||
Reference in New Issue
Block a user