dotfiles

regexghost dotfiles and scripts
git clone https://git.regexghost.com/dotfiles.git
Log | Files | Refs | README

weather-formatter.sh (4209B)


      1 #!/usr/bin/env bash
      2 
      3 # Formatter for weather conditions
      4 # Takes string (e.g. "Overcast Sunny") and outputs icon with colour formatting
      5 
      6 source "$XDG_CONFIG_HOME/regexghost/current-theme.sh"
      7 
      8 function format() {
      9 	icon_name="$1"
     10 	if [[ "$2" == "conky" ]]; then
     11 		if [[ "$icon_name" == "Sunny day" ]]; then
     12 			echo "\${color #$YELLOW}\${font4}  \${font}\${color}"
     13 		elif [[ "$icon_name" == "Light shower day" ]]; then
     14 			echo "\${color #$WHITE}\${font4}  \${font}\${color}"
     15 		elif [[ "$icon_name" == "Heavy shower day" ]]; then
     16 			echo "\${color #$WHITE}\${font4}  \${font}\${color}"
     17 		elif [[ "$icon_name" == "Sunny intervals" ]]; then
     18 			echo "\${color #$YELLOW}\${font4}  \${font}\${color}"
     19 		elif [[ "$icon_name" == "Light rain" ]]; then
     20 			echo "\${color #$BRIGHT_BLACK}\${font4}  \${font}\${color}"
     21 		elif [[ "$icon_name" == "Heavy rain" ]]; then
     22 			echo "\${color #$BLUE}\${font4}  \${font}\${color}"
     23 		elif [[ "$icon_name" == "Cloudy" ]]; then
     24 			echo "\${color #$WHITE}\${font4}  \${font}\${color}"
     25 		elif [[ "$icon_name" == "Overcast" ]]; then
     26 			echo "\${color #$BRIGHT_BLACK}\${font4}  \${font}\${color}"
     27 		elif [[ "$icon_name" == "Light snow shower day" ]]; then
     28 			echo "\${color #$WHITE}\${font4}  \${font}\${color}"
     29 		else
     30 			echo "\${color #$RED}\${font4}  \${font}\${color}"
     31 		fi
     32 	elif [[ "$2" == "lemonbar" ]]; then
     33 		if [[ "$icon_name" == "Sunny day" ]]; then
     34 			echo "%{F#$YELLOW}  %{F-}"
     35 		elif [[ "$icon_name" == "Light shower day" ]]; then
     36 			echo "%{F#$WHITE}  %{F-}"
     37 		elif [[ "$icon_name" == "Heavy shower day" ]]; then
     38 			echo "%{F#$WHITE}  %{F-}"
     39 		elif [[ "$icon_name" == "Sunny intervals" ]]; then
     40 			echo "%{F#$YELLOW}  %{F-}"
     41 		elif [[ "$icon_name" == "Light rain" ]]; then
     42 			echo "%{F#$BRIGHT_BLACK}  %{F-}"
     43 		elif [[ "$icon_name" == "Heavy rain" ]]; then
     44 			echo "%{F#$BLUE}  %{F-}"
     45 		elif [[ "$icon_name" == "Cloudy" ]]; then
     46 			echo "%{F#$WHITE}  %{F-}"
     47 		elif [[ "$icon_name" == "Overcast" ]]; then
     48 			echo "%{F#$BRIGHT_BLACK}  %{F-}"
     49 		elif [[ "$icon_name" == "Light snow shower day" ]]; then
     50 			echo "%{F#$WHITE}  %{F-}"
     51 		else
     52 			echo "%{F#$RED}  %{F-}"
     53 		fi
     54 	else
     55 		if [[ "$icon_name" == "Sunny day" ]]; then
     56 			echo "<span font='Font Awesome 7 Free Solid 9' foreground='#$YELLOW'>  </span>"
     57 		elif [[ "$icon_name" == "Light shower day" ]]; then
     58 			echo "<span font='Font Awesome 7 Free Solid 9' foreground='#$WHITE'>  </span>"
     59 		elif [[ "$icon_name" == "Heavy shower day" ]]; then
     60 			echo "<span font='Font Awesome 7 Free Solid 9' foreground='#$WHITE'>  </span>"
     61 		elif [[ "$icon_name" == "Sunny intervals" ]]; then
     62 			echo "<span font='Font Awesome 7 Free Solid 9' foreground='#$YELLOW'>  </span>"
     63 		elif [[ "$icon_name" == "Light rain" ]]; then
     64 			echo "<span font='Font Awesome 7 Free Solid 9' foreground='#$BRIGHT_BLACK'>  </span>"
     65 		elif [[ "$icon_name" == "Heavy rain" ]]; then
     66 			echo "<span font='Font Awesome 7 Free Solid 9' foreground='#$BLUE'>  </span>"
     67 		elif [[ "$icon_name" == "Cloudy" ]]; then
     68 			echo "<span font='Font Awesome 7 Free Solid 9' foreground='#$WHITE'>  </span>"
     69 		elif [[ "$icon_name" == "Overcast" ]]; then
     70 			echo "<span font='Font Awesome 7 Free Solid 9' foreground='#$BRIGHT_BLACK'>  </span>"
     71 		elif [[ "$icon_name" == "Light snow shower day" ]]; then
     72 			echo "<span font='Font Awesome 7 Free Solid 9' foreground='#$WHITE'>  </span>"
     73 		else
     74 			echo "<span font='Font Awesome 7 Free Solid 9' foreground='#$RED'>  </span>"
     75 		fi
     76 	fi
     77 }
     78 
     79 if [[ "$1" == "--conky" ]]; then
     80 	echo "$(format "$2" conky)"
     81 elif [[ "$1" == "--lemonbar" ]]; then
     82 	echo "$(format "$2" lemonbar)"
     83 else
     84 	echo "$(format "$1")"
     85 fi
     86 
     87 # moon rain 
     88 # heavy showers 
     89 # snow 
     90 # lightning 
     91 # bolt 
     92 # sun 
     93 # moon 
     94 # smog 
     95 # tornado 
     96 # cloud showers water 
     97 # cloud moon 
     98 # hurricane 
     99 # water 
    100 # wind 
    101 # bolt lightning 
    102 # umbrella 
    103 # volcano 
    104 # temperature half 
    105 # temperature three quarters 
    106 # temperature quarter 
    107 # temperature low 
    108 # temperature high 
    109 # temperature full 
    110 # temperature empty 
    111 # temperature arrow up 
    112 # temperature arrow down 
    113 # sun plant wilt 
    114 # rainbow 
    115 # icicles 
    116 # house tsunami 