Inital commit

This commit is contained in:
koffeejava
2026-03-12 18:41:15 -06:00
commit ac429a8fc3
10 changed files with 268 additions and 0 deletions
+78
View File
@@ -0,0 +1,78 @@
def icon(id)
orange = "\e[38;5;214m"
gray = "\e[38;5;241m"
blue = "\e[38;5;33m"
yellow = "\e[38;5;220m"
reset = "\e[0m"
bold = "\033[1m"
if id == 1000
print "#{bold}#{orange}
⠀⠀⠀⠀⡄⡢⡪⢪⢊⠎⡆⡢⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⡰⡑⡅⡇⢎⢪⢸⢘⢌⢎⢜⢔⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⡰⡡⡣⡱⡸⡘⡌⡆⢇⢕⠜⡔⡱⢱⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⡪⡢⡱⡸⡐⡕⡱⡸⡘⡔⢕⢱⢸⢨⠂⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢊⢆⢣⢪⠸⡨⡢⢣⠪⡊⡎⡪⢢⠣⠁⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠣⡱⡸⡘⡌⢎⠆⡇⡣⡪⡊⡆⠃⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⠌⡪⡸⡨⡪⢪⠸⡐⠑⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠈⠈⠀#{reset}"
elsif id == 1003
print "#{bold}#{orange}
#{bold}#{orange}⠀⢠⢠⢢⢢⢢⢢⡀ #{reset}
⠀⡐⠠⠡⢁⢂#{bold}#{orange}⠸⡸⡸⡸⡸⡘⡆⡇⡧⡀#{reset}
⠀⡂⡂⠅⠅⡂⡂⡂#{bold}#{orange}⠱⠱⠱⢱⢱⢱⢱⢱⢱⠀#{reset}
⠀⠀⠀⠀⠀⠀⠠⢀⢂⢂⠂⠅⠅⡂⡂⡂⠅⠅⠅⡂#{bold}#{orange}⢣⢣⢣⢣⠣⠀#{reset}
⠀⠀⠀⠀⠀⠠⢁⢂⢂⠂⠌⠌⡐⡐⡐⠠⠡⠡⢁⠂⠌⠌#{bold}#{orange}⠪⡪⠂⠀#{reset}
⠀⠀⠀⠀⠀⠨⢐⢐⢐⠨⠨⢐⢐⢐⠠⠡⠡⢁⠂⠌⠌⠌⡐⡀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠂⠂⠂⠌⠌⠐⠐⠐⠨⠨⠨⠐⠨⠨⠨⠐⠐⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
"
elsif id == 1006
print "
⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⡐⠨⢐⢐⢐⠨⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡂⠅⡂⡂⡂⠌⠌⡐⡐⡐⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢀⢐⠨⢐⠠⢁⢂⢂⠂⠅⠅⡂⡂⡂⠅⠅⡀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡂⡂⠌⡐⠨⢐⢐⢐⠨⠨⢐⢐⢐⠠⠡⢁⠂⠅⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠐⠠⢁⠂⠅⡂⡂⡂⠌⠌⡐⡐⡐⠨⠨⢐⠨⠨⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠈⠐⠈⠐⠐⠐⠀⠁⠁⠂⠂⠂⠁⠁⠂⠈⠀⠀⠀⠀⠀⠀⠀ "
elsif id == 1009 || id == 804
print "
#{gray} ⠀⢠⣰⢴⢦⣄⠀#{reset}
⠀⡀⡐⡐⡐#{gray}⡈⠳⡯⡯⡷⣝⡧⣠⢄⡀⠀#{reset}
⠀⢐⢐⢐⢐⢐⠠⠡#{gray}⢙⠽⠽⡳⣝⣗⡯⣯⢀⠀#{reset}
⠀⠄⠄⡐⡐⡐⡐⡐⠨⠨⢐⠨⢐⠠#{gray}⢹⢮⡻⡮⣯⣻⠄⠀#{reset}
⠀⠀⠀⠀⠠⠨⠨⢐⢐⢐⢐⢐⠠⠡⢁⠂⠌⡐⠨⠨⠩#{gray}⠙⣽⣺⠺⠁⠀#{reset}
⠀⠀⠀⠀⠨⠨⠨⢐⢐⢐⢐⢐⠨⠨⢐⠨⢐⠠⠡⠡⠡⢁⠂⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠈⠌⠐⠐⠐⠐⠐⠨⠨⠐⠨⠐⠨⠨⠨⠨⠐⠀⠀⠀⠀⠀⠀⠀⠀
"
elsif id == 1072 || id == 1150 || id == 1153 || id == 1168 || id == 1180 || id == 1183 || id == 1186 || id == 1189 || id == 1198 || id == 1240
print "
⠀⠠⠠⢐⠀#{gray}⢮⢯⣗⣟⡦⣠⡀⠀#{reset}
⠀⠠⠡⢁⠂⠌⠄#{gray}⠹⠞⢮⡻⣮⣻⣂⡀⠀#{reset}
⠀⠄⡂⠅⠅⡂⠌⠌⠌⠌⠌⡐#{gray}⡸⣗⣗⣗⣟⠆⠀#{reset}
⠀⠀⠀⠀⠀⠀⠨⢐⠠⠡⢁⠂⠅⠅⠅⠅⠅⡂⡂⡂⡑⠓#{gray}⠉⠀#{reset}
⠀⠈⠐⠨⠨⠐#{blue}#{reset}⠨⠨⠨⠨⢐⢐⢐⢐⠐⠀
#{blue}⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣄⠁⢠⡄⠀⢜⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠋⠠⣈⠂⡠⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ #{reset}
"
elsif id == 1087
print "
#{gray}⡀⣤⢤⣤⡀⠀#{reset}
⠀⢀⢐⢐⢐⠐#{gray}⢽⣺⢽⢮⡻⣆⣄⣄⠀#{reset}
⠀⢐⢐⢐⢐⢐⠨⠠#{gray}⢹⠽⠽⣽⣺⡺⡮⣇⡀⠀#{reset}
⠀⠠⠠⢐⢐⢐⢐⢐⠨⠨⢐⠨⢐⠈#{gray}⡾⡽⡽⡮⡯⣧⠀#{reset}
⠀⠀⠀⠀⠀⠌⠌⠌⡐⡐⡐⡐⡐⠨⠨⢐⠨⢐⠠⠡⢉#{gray}⢫⢯⠻⠊⠀#{reset}
⠀⠡⠡⢁⢂⢂#{yellow}⢢⡒⡎#{reset}⠌⠌⡐⠨⢐⠨⠨⢐⢐⠀
⠀⠁⠂⠂#{yellow}⡂⡇⡇⡖#{reset}⠡⠁⠂⠅⠂⠌⠌⠐⠀
#{yellow}⠀⡜⠌⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀#{reset}
"
end
end
+93
View File
@@ -0,0 +1,93 @@
require "http/client"
require "json"
require "toml"
require "./icon-list"
require "option_parser"
module Wfetch
VERSION = "0.1.0"
orange = "\e[38;5;214m"
red = "\e[38;5;52m"
bold = "\033[1m"
reset = "\e[0m"
puts "#{bold}#{orange}Wfetch KoffeeJava 2026#{reset}"
debug = false
OptionParser.parse do |parser|
parser.banner = "Usage: wfetch [arguments]"
parser.on("-i", "--icons", "Shows all icons") {
icon(1000)
icon(1003)
icon(1006)
icon(1009)
icon(1072)
icon(1087)
print "End"
exit(1)
}
parser.on("-v", "--verbose", "Gives additional details.") {debug = true}
parser.on("-h", "--help", "Show this help") do
puts parser
exit(1)
end
parser.invalid_option do |flag|
STDERR.puts "ERROR: #{flag} is not a valid option."
STDERR.puts parser
exit(1)
end
end
config = TOML.parse(File.read("/home/koffeejava/.local/share/Wfetch/config.toml"))
city = config["city"]
api_key = config["api"]
response = HTTP::Client.get "http://api.weatherapi.com/v1/current.json?q=#{city}&key=#{api_key}"
if response.status_code != 200
puts "Error: status code #{response.status_code}"
exit
end
data = JSON.parse(response.body.lines.join)
if debug == true
puts data
end
fftemp = data["current"]["feelslike_f"]
fctemp = data["current"]["feelslike_c"]
temp = data["current"]["temp_f"]
tempm = data["current"]["temp_c"]
desc = data["current"]["condition"]["text"]
pressin = data["current"]["pressure_in"]
pressmb = data["current"]["pressure_mb"]
cwind = data["current"]["wind_mph"]
mwind = data["current"]["wind_kph"]
humidity = data["current"]["humidity"]
vism = data["current"]["vis_miles"]
visk = data["current"]["vis_km"]
heatindex_f = data["current"]["heatindex_f"]
heatindex_c = data["current"]["heatindex_c"]
windchill_f = data["current"]["windchill_f"]
windchill_c = data["current"]["windchill_c"]
id = data["current"]["condition"]["code"]
disp = TOML.parse(File.read("/home/koffeejava/.local/share/Wfetch/disp.toml"))
repeat = 1
File.each_line("/home/koffeejava/.local/share/Wfetch/disp.toml") do |line|
if disp["#{repeat}"].to_s == "{icon}"
icon(id)
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
end
end