dotfiles

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

weather-formatter.sh (3871B)


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