Skip to content

Commit

Permalink
celsius option
Browse files Browse the repository at this point in the history
  • Loading branch information
danerwilliams committed Apr 29, 2020
1 parent 0b57353 commit 60675a1
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 26 deletions.
2 changes: 1 addition & 1 deletion data/weather.txt
@@ -1 +1 @@
Loading Weather...
☀ 18° Pleasanton, CA
3 changes: 0 additions & 3 deletions dracula.tmux
@@ -1,8 +1,5 @@
#!/usr/bin/env bash

# Author: Dane Williams
# a theme for tmux inspired by dracula

# source and run dracula theme

current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
Expand Down
4 changes: 0 additions & 4 deletions scripts/battery.sh
@@ -1,9 +1,5 @@
#!/usr/bin/env bash

#author: Dane Williams
#scipt for gathering battery percentage and A/C status
#script is called in dracula.tmux program

battery_percent()
{
# Check OS
Expand Down
9 changes: 3 additions & 6 deletions scripts/dracula.sh
@@ -1,8 +1,5 @@
#!/usr/bin/env bash

# a tmux color scheme inspired by dracula
# author: Dane Williams

get_tmux_option() {
local option=$1
local default_value=$2
Expand All @@ -23,7 +20,7 @@ main()
show_battery=$(get_tmux_option "@dracula-show-battery" true)
show_network=$(get_tmux_option "@dracula-show-network" true)
show_weather=$(get_tmux_option "@dracula-show-weather" true)
fahrenheit=$(get_tmux_option "@dracula-fahrenheit" true)
show_fahrenheit=$(get_tmux_option "@dracula-show-fahrenheit" true)

# Dracula Color Pallette
white='#f8f8f2'
Expand All @@ -40,7 +37,7 @@ main()

# start weather script in background
if $show_weather; then
$current_dir/sleep_weather.sh &
$current_dir/sleep_weather.sh $show_fahrenheit &
fi

# set refresh interval
Expand Down Expand Up @@ -76,7 +73,7 @@ main()
fi

if $show_weather; then
tmux set-option -ga status-right "#[fg=${dark_gray},bg=${orange}] #(cat $current_dir/../data/weather.txt) "
tmux set-option -ga status-right "#[fg=${dark_gray},bg=${orange}] #(cat $current_dir/../data/weather.txt) "
fi

tmux set-option -ga status-right "#[fg=${white},bg=${dark_purple}] %a %m/%d %I:%M %p #(date +%Z) "
Expand Down
4 changes: 0 additions & 4 deletions scripts/network.sh
@@ -1,9 +1,5 @@
#!/usr/bin/env bash

#author: Dane Williams
#script for gathering internet connectivity info
#script is called in dracula.tmux program

HOSTS="google.com github.com example.com"

get_ssid()
Expand Down
4 changes: 3 additions & 1 deletion scripts/sleep_weather.sh
Expand Up @@ -2,6 +2,8 @@

#wrapper script for running weather on interval

fahrenheit=$1

main()
{
current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
Expand All @@ -10,7 +12,7 @@ main()

while tmux has-session &> /dev/null
do
$current_dir/weather.sh > $current_dir/../data/weather.txt
$current_dir/weather.sh $fahrenheit > $current_dir/../data/weather.txt
if tmux has-session &> /dev/null
then
sleep 1200
Expand Down
15 changes: 8 additions & 7 deletions scripts/weather.sh
@@ -1,11 +1,8 @@
#!/usr/bin/env bash

#author: Dane Williams
#script for gathering current location and weather at location
#script is then called in the dracula.tmux program

# test if rate limit hit
# only testing last request because of redundancy
fahrenheit=$1

load_request_params()
{

Expand Down Expand Up @@ -33,7 +30,11 @@ weather_information()
}
get_temp()
{
weather_information | grep 'deg;F' | cut -d '&' -f 1
if $fahrenheit; then
echo $(weather_information | grep 'deg;F' | cut -d '&' -f 1)
else
echo $(( ($(weather_information | grep 'deg;F' | cut -d '&' -f 1) - 32) * 5 / 9 ))
fi
}
forecast_unicode()
{
Expand All @@ -57,7 +58,7 @@ forecast_unicode()
display_weather()
{
if [ $country = 'US' ]; then
echo "$(forecast_unicode)$(get_temp)°F"
echo "$(forecast_unicode)$(get_temp)°"
else
echo ''
fi
Expand Down

0 comments on commit 60675a1

Please sign in to comment.