added support for comments in disp.toml

This commit is contained in:
koffeejava
2026-03-12 19:14:04 -06:00
parent 36af8d8233
commit faa0bf7cd5
2 changed files with 16 additions and 3 deletions

View 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}"

View File

@@ -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
if entry
if entry.to_s == "{icon}"
icon(id) icon(id)
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) 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
repeat += 1 repeat += 1
end end