added support for comments in disp.toml
This commit is contained in:
9
disp-configs/customary.toml
Normal file
9
disp-configs/customary.toml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# This is for customary units
|
||||||
|
|
||||||
|
1 = "{icon}"
|
||||||
|
2 = "Live Temperature: {temp_f}°"
|
||||||
|
3 = "Feels like: {feels_temp_f}°"
|
||||||
|
4 = "Wind Speed: {wind_mph} MPH"
|
||||||
|
5 = "Humidity: {humidity}%"
|
||||||
|
6 = "Pressure: {pressure_in}"
|
||||||
|
7 = "Description: {orange}{bold}{description}{reset}"
|
||||||
@@ -82,10 +82,14 @@ module Wfetch
|
|||||||
|
|
||||||
repeat = 1
|
repeat = 1
|
||||||
File.each_line("/home/koffeejava/.local/share/Wfetch/disp.toml") do |line|
|
File.each_line("/home/koffeejava/.local/share/Wfetch/disp.toml") do |line|
|
||||||
if disp["#{repeat}"].to_s == "{icon}"
|
entry = disp["#{repeat}"]? # Use []? to avoid KeyError
|
||||||
icon(id)
|
|
||||||
|
if entry
|
||||||
|
if entry.to_s == "{icon}"
|
||||||
|
icon(id)
|
||||||
|
end
|
||||||
|
puts entry.to_s.gsub("{temp_f}", temp).gsub("{temp_c}", tempm).gsub("{feels_temp_f}", fftemp).gsub("{feels_temp_c}", fctemp).gsub("{wind_mph}", cwind).gsub("{wind_kph}", mwind).gsub("{humidity}", humidity).gsub("{pressure_in}", pressin).gsub("{description}", desc).gsub("{orange}", "\e[38;5;214m").gsub("{blue}", "\e[38;5;33m").gsub("{bold}", "\033[1m").gsub("{reset}", "\e[0m").gsub("{icon}", nil)
|
||||||
end
|
end
|
||||||
puts disp["#{repeat}"].to_s.gsub("{temp_f}", temp).gsub("{temp_c}", tempm).gsub("{feels_temp_f}", fftemp).gsub("{feels_temp_c}", fctemp).gsub("{wind_mph}", cwind).gsub("{wind_kph}", mwind).gsub("{humidity}", humidity).gsub("{pressure_in}", pressin).gsub("{description}", desc).gsub("{orange}", "\e[38;5;214m").gsub("{blue}", "\e[38;5;33m").gsub("{bold}", "\033[1m").gsub("{reset}", "\e[0m").gsub("{icon}", nil)
|
|
||||||
|
|
||||||
repeat += 1
|
repeat += 1
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user