mirror of
https://git.adityakumar.xyz/dwmbar.git
synced 2024-11-09 22:19:45 +00:00
Renamed functions inside modules to get_functionname
This commit is contained in:
parent
04c033a5e8
commit
7026bc81aa
4 changed files with 47 additions and 6 deletions
|
@ -5,7 +5,7 @@
|
|||
|
||||
PREFIX=' Updates:'
|
||||
|
||||
updates()
|
||||
get_updates()
|
||||
{
|
||||
if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then
|
||||
updates_arch=0
|
||||
|
@ -20,4 +20,4 @@ updates()
|
|||
echo "$PREFIX $updates"
|
||||
}
|
||||
|
||||
updates
|
||||
get_updates
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
PREFIX=''
|
||||
|
||||
date()
|
||||
get_date()
|
||||
{
|
||||
echo "$PREFIX $(date '+%d-%m-%y (%a)')"
|
||||
}
|
||||
|
||||
date
|
||||
get_date
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
PREFIX=' '
|
||||
|
||||
time()
|
||||
get_time()
|
||||
{
|
||||
echo "$PREFIX$(date '+%H:%M')"
|
||||
}
|
||||
|
||||
time
|
||||
get_time
|
||||
|
|
41
modules/weather
Normal file
41
modules/weather
Normal file
|
@ -0,0 +1,41 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prints out the weather at your approximate location
|
||||
|
||||
get_weather()
|
||||
{
|
||||
LOCATION=$(geolocate)
|
||||
LANG="en"
|
||||
UNITS="Metric"
|
||||
API_KEY="756edce7e9d4c385ef9499a53492678c"
|
||||
|
||||
LOCATION_FORMATTED_2=$(echo $LOCATION | cut -d ':' -f2)
|
||||
LOCATION_FORMATTED_1=$(echo $LOCATION | cut -d ':' -f1)
|
||||
|
||||
OUTPUT=$(curl -s "http://api.openweathermap.org/data/2.5/weather?lat=$LOCATION_FORMATTED_1&lon=$LOCATION_FORMATTED_2&lang=$LANG&appid=$API_KEY&units=$UNITS")
|
||||
STATUS=$(echo $OUTPUT | jq '.weather' | tr '[' ' ' | tr ']' ' ' | jq '.main' | sed 's/"//g')
|
||||
TEMP=$(echo $OUTPUT | jq '.main' | jq '.temp' | xargs printf "%.*f\n" 0)
|
||||
|
||||
case $STATUS in
|
||||
"Clear" )
|
||||
echo "";;
|
||||
"Clouds" )
|
||||
echo "摒";;
|
||||
"Rain" )
|
||||
echo "歹";;
|
||||
"Thunderstorm" )
|
||||
echo "朗";;
|
||||
"Snow" )
|
||||
echo "流";;
|
||||
"Mist" )
|
||||
echo "敖";;
|
||||
* )
|
||||
echo "?";;
|
||||
esac
|
||||
|
||||
echo "$STATUS, "
|
||||
echo "$TEMP°C"
|
||||
}
|
||||
|
||||
get_weather
|
||||
|
Loading…
Reference in a new issue