Merge pull request #1 from KoffeeJava/dev

Push to master
This commit is contained in:
KoffeeJava
2026-03-14 20:47:26 -06:00
committed by GitHub
8 changed files with 290 additions and 138 deletions

View File

@@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2026 koffeejava <aidenspurger572@gmail.com> Copyright (c) 2026 koffeejava
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@@ -6,19 +6,48 @@ This version of wfetch is semi-backwards compatible (config.toml will work! But
## Installation ## Installation
Run the installer executible in root and follow instructions. ### Linux
Fist download the latest release fron the releases page and extract it. Inside of the folder, you will see an executible named "wf-tool".
This will be the program that you will use to install and setup wfetch.
Open your favorite terminal in the folder and run `sudo ./wf-tool -i` This will install wfetch.
> **WARNING**: You must run wf-tool with sudo to install wfetch.
Wfetch should quickly install. After wfetch is installed, run `./wf-tool -s` and follow the setup instructions
> **WARNING**: Do not run this command under sudo. It will not let you run the setup if you do so.
### Windows
At this time Windows dows not have a build.
### MacOS
At this time MacOS does not have a build.
## Compiling
### Requirements
- Crystal compiler
- Wfetch Source Code
- wfetch-1.0.0-data.tar.gz
Download the latest release's source code and open your terminal inside the directory and run `shards build --release` and the build will be outputted in bin/
To actually install and setup your wfetch build, you will need to have a data directory with wftech and the disp configs.
Extract the data directory file and copy it to where your wfetch and wf-tool executable are. Once your data directory is copied/moved over, move wfetch inside of the data directory and then follow the installing instructions.
## FAQ ## FAQ
### How do I get an Weather API key? ### How do I get an Weather API key?
First, go to the [Weather API](https://www.weatherapi.com/) website and then sign up. When finished creating an account, login then copy your api key. First, go to the [Weather API](https://www.weatherapi.com/) website and then sign up. When finished creating an account, login then copy your api key.
Make sure to paste that api key to setup.
### Why don't you provide an api key? ### Why don't you provide an api key?
I'm lazy. (plus api call limit stuff) Giving out an api key is one of the top ten things to never do in your life.
## Contributing ## Contributing

View File

@@ -1,9 +0,0 @@
# 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

@@ -8,6 +8,9 @@ targets:
wfetch: wfetch:
main: src/wfetch.cr main: src/wfetch.cr
wf-tool:
main: src/wf-tool.cr
crystal: '>= 1.19.1' crystal: '>= 1.19.1'
license: MIT license: MIT

View File

@@ -1,6 +1,6 @@
def icon(id) def icon(id)
gray = "\e[38;5;241m" gray = "\e[38;5;8m"
blue = "\e[38;5;33m" blue = "\e[38;5;33m"
yellow = "\e[38;5;220m" yellow = "\e[38;5;220m"
reset = "\e[0m" reset = "\e[0m"
@@ -8,15 +8,15 @@ def icon(id)
if Time.local.minute < 10 if Time.local.minute < 10
time = (Time.local.hour.to_s + 0.to_s + Time.local.minute.to_s).to_i time = (Time.local.hour.to_s + 0.to_s + Time.local.minute.to_s).to_i
if time > 1200 if time > 1830
orange = "\e[38;5;235m" orange = "\e[38;5;8m"
else else
orange = "\e[38;5;214m" orange = "\e[38;5;214m"
end end
elsif Time.local.minute >= 10 elsif Time.local.minute >= 10
time = (Time.local.hour.to_s + Time.local.minute.to_s).to_i time = (Time.local.hour.to_s + Time.local.minute.to_s).to_i
if time > 1200 if time > 1830
orange = "\e[38;5;235m" orange = "\e[38;5;8m"
else else
orange = "\e[38;5;214m" orange = "\e[38;5;214m"
end end
@@ -30,8 +30,7 @@ def icon(id)
⠀⠀⠀⠀⠀⠀⠀⠀⡪⡢⡱⡸⡐⡕⡱⡸⡘⡔⢕⢱⢸⢨⠂⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⡪⡢⡱⡸⡐⡕⡱⡸⡘⡔⢕⢱⢸⢨⠂⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢊⢆⢣⢪⠸⡨⡢⢣⠪⡊⡎⡪⢢⠣⠁⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⢊⢆⢣⢪⠸⡨⡢⢣⠪⡊⡎⡪⢢⠣⠁⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠣⡱⡸⡘⡌⢎⠆⡇⡣⡪⡊⡆⠃⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠣⡱⡸⡘⡌⢎⠆⡇⡣⡪⡊⡆⠃⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⠌⡪⡸⡨⡪⢪⠸⡐⠑⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⠌⡪⡸⡨⡪⢪⠸⡐⠑⠀⠀⠀#{reset}"
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⠀⠀#{reset}"
elsif id == 1003 elsif id == 1003
print "#{bold}#{orange} print "#{bold}#{orange}
#{bold}#{orange}⠀⠀⢠⢠⢢⢢⢢⢢⡀ #{reset} #{bold}#{orange}⠀⠀⢠⢠⢢⢢⢢⢢⡀ #{reset}
@@ -40,8 +39,7 @@ def icon(id)
⠀⠀⠀⠀⠀⠀⠠⢀⢂⢂⠂⠅⠅⡂⡂⡂⠅⠅⠅⡂#{bold}#{orange}⢣⢣⢣⢣⠣⠀⠀⠀⠀⠀#{reset} ⠀⠀⠀⠀⠀⠀⠠⢀⢂⢂⠂⠅⠅⡂⡂⡂⠅⠅⠅⡂#{bold}#{orange}⢣⢣⢣⢣⠣⠀⠀⠀⠀⠀#{reset}
⠀⠀⠀⠀⠀⠠⢁⢂⢂⠂⠌⠌⡐⡐⡐⠠⠡⠡⢁⠂⠌⠌#{bold}#{orange}⠪⡪⠂⠀⠀⠀⠀⠀#{reset} ⠀⠀⠀⠀⠀⠠⢁⢂⢂⠂⠌⠌⡐⡐⡐⠠⠡⠡⢁⠂⠌⠌#{bold}#{orange}⠪⡪⠂⠀⠀⠀⠀⠀#{reset}
⠀⠀⠀⠀⠀⠨⢐⢐⢐⠨⠨⢐⢐⢐⠠⠡⠡⢁⠂⠌⠌⠌⡐⡀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠨⢐⢐⢐⠨⠨⢐⢐⢐⠠⠡⠡⢁⠂⠌⠌⠌⡐⡀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠂⠂⠂⠌⠌⠐⠐⠐⠨⠨⠨⠐⠨⠨⠨⠐⠐⠀⠀ ⠀⠀⠀⠀⠀⠀⠂⠂⠂⠌⠌⠐⠐⠐⠨⠨⠨⠐⠨⠨⠨⠐⠐⠀⠀"
"
elsif id == 1006 elsif id == 1006
print " print "
⠀⡐⠨⢐⢐⢐⠨⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⡐⠨⢐⢐⢐⠨⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
@@ -52,60 +50,52 @@ def icon(id)
⠀⠀⠀⠀⠀⠀⠀⠈⠐⠈⠐⠐⠐⠀⠁⠁⠂⠂⠂⠁⠁⠂⠈⠀⠀⠀⠀⠀⠀⠀ " ⠀⠀⠀⠀⠀⠀⠀⠈⠐⠈⠐⠐⠐⠀⠁⠁⠂⠂⠂⠁⠁⠂⠈⠀⠀⠀⠀⠀⠀⠀ "
elsif id == 1009 || id == 804 elsif id == 1009 || id == 804
print " print "
#{gray} ⠀⢠⣰⢴⢦⣄⠀⠀⠀#{reset} #{bold}#{gray} ⠀⢠⣰⢴⢦⣄⠀⠀⠀#{reset}
⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⡐⡐⡐#{gray}⡈⠳⡯⡯⡷⣝⡧⣠⢄⡀⠀⠀⠀⠀⠀#{reset} ⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⡐⡐⡐#{bold}#{gray}⡈⠳⡯⡯⡷⣝⡧⣠⢄⡀⠀⠀⠀⠀⠀#{reset}
⠀⠀⠀⠀⠀⠀⠀⠀⢐⢐⢐⢐⢐⠠⠡#{gray}⢙⠽⠽⡳⣝⣗⡯⣯⢀⠀⠀⠀⠀⠀⠀#{reset} ⠀⠀⠀⠀⠀⠀⠀⠀⢐⢐⢐⢐⢐⠠⠡#{bold}#{gray}⢙⠽⠽⡳⣝⣗⡯⣯⢀⠀⠀⠀⠀⠀⠀#{reset}
⠀⠀⠀⠀⠀⠀⠄⠄⡐⡐⡐⡐⡐⠨⠨⢐⠨⢐⠠#{gray}⢹⢮⡻⡮⣯⣻⠄⠀⠀⠀⠀#{reset} ⠀⠀⠀⠀⠀⠀⠄⠄⡐⡐⡐⡐⡐⠨⠨⢐⠨⢐⠠#{bold}#{gray}⢹⢮⡻⡮⣯⣻⠄⠀⠀⠀⠀#{reset}
⠀⠀⠀⠀⠠⠨⠨⢐⢐⢐⢐⢐⠠⠡⢁⠂⠌⡐⠨⠨⠩#{gray}⠙⣽⣺⠺⠁⠀⠀⠀⠀#{reset} ⠀⠀⠀⠀⠠⠨⠨⢐⢐⢐⢐⢐⠠⠡⢁⠂⠌⡐⠨⠨⠩#{bold}#{gray}⠙⣽⣺⠺⠁⠀⠀⠀⠀#{reset}
⠀⠀⠀⠀⠨⠨⠨⢐⢐⢐⢐⢐⠨⠨⢐⠨⢐⠠⠡⠡⠡⢁⠂⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠨⠨⠨⢐⢐⢐⢐⢐⠨⠨⢐⠨⢐⠠⠡⠡⠡⢁⠂⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠈⠌⠐⠐⠐⠐⠐⠨⠨⠐⠨⠐⠨⠨⠨⠨⠐⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠈⠌⠐⠐⠐⠐⠐⠨⠨⠐⠨⠐⠨⠨⠨⠨⠐⠀⠀⠀⠀⠀⠀⠀⠀ "
"
elsif id == 1072 || id == 1150 || id == 1153 || id == 1168 || id == 1180 || id == 1183 || id == 1186 || id == 1189 || id == 1198 || id == 1240 elsif id == 1072 || id == 1150 || id == 1153 || id == 1168 || id == 1180 || id == 1183 || id == 1186 || id == 1189 || id == 1198 || id == 1240
print " print "
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠠⢐⠀#{gray}⢮⢯⣗⣟⡦⣠⡀⠀⠀⠀⠀⠀⠀⠀⠀#{reset} ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠠⢐⠀#{bold}#{gray}⢮⢯⣗⣟⡦⣠⡀⠀⠀⠀⠀⠀⠀⠀⠀#{reset}
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠡⢁⠂⠌⠄#{gray}⠹⠞⢮⡻⣮⣻⣂⡀⠀⠀⠀⠀⠀⠀⠀#{reset} ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠡⢁⠂⠌⠄#{bold}#{gray}⠹⠞⢮⡻⣮⣻⣂⡀⠀⠀⠀⠀⠀⠀⠀#{reset}
⠀⠀⠀⠀⠀⠀⠀⠄⡂⠅⠅⡂⠌⠌⠌⠌⠌⡐#{gray}⡸⣗⣗⣗⣟⠆⠀⠀⠀⠀⠀⠀#{reset} ⠀⠀⠀⠀⠀⠀⠀⠄⡂⠅⠅⡂⠌⠌⠌⠌⠌⡐#{bold}#{gray}⡸⣗⣗⣗⣟⠆⠀⠀⠀⠀⠀⠀#{reset}
⠀⠀⠀⠀⠀⠀⠨⢐⠠⠡⢁⠂⠅⠅⠅⠅⠅⡂⡂⡂⡑⠓#{gray}⠉⠀⠀⠀⠀⠀⠀⠀#{reset} ⠀⠀⠀⠀⠀⠀⠨⢐⠠⠡⢁⠂⠅⠅⠅⠅⠅⡂⡂⡂⡑⠓#{bold}#{gray}⠉⠀⠀⠀⠀⠀⠀⠀#{reset}
⠀⠀⠀⠀⠀⠀⠈⠐⠨⠨⠐#{blue}#{reset}⠨⠨⠨⠨⢐⢐⢐⢐⠐⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠈⠐⠨⠨⠐#{bold}#{blue}#{reset}⠨⠨⠨⠨⢐⢐⢐⢐⠐⠀⠀⠀⠀⠀⠀⠀⠀⠀
#{blue}⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣄⠁⢠⡄⠀⢜⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ #{bold}#{blue}⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣄⠁⢠⡄⠀⢜⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠋⠠⣈⠂⡠⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠋⠠⣈⠂⡠⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ #{reset} ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ #{reset} "
"
elsif id == 1087 elsif id == 1087
print " print "
#{gray}⡀⣤⢤⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀#{reset} #{bold}#{gray}⡀⣤⢤⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀#{reset}
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢐⢐⢐⠐#{gray}⢽⣺⢽⢮⡻⣆⣄⣄⠀⠀⠀⠀⠀⠀⠀⠀#{reset} ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢐⢐⢐⠐#{bold}#{gray}⢽⣺⢽⢮⡻⣆⣄⣄⠀⠀⠀⠀⠀⠀⠀⠀#{reset}
⠀⠀⠀⠀⠀⠀⠀⠀⢐⢐⢐⢐⢐⠨⠠#{gray}⢹⠽⠽⣽⣺⡺⡮⣇⡀⠀⠀⠀⠀⠀⠀#{reset} ⠀⠀⠀⠀⠀⠀⠀⠀⢐⢐⢐⢐⢐⠨⠠#{bold}#{gray}⢹⠽⠽⣽⣺⡺⡮⣇⡀⠀⠀⠀⠀⠀⠀#{reset}
⠀⠀⠀⠀⠀⠀⠠⠠⢐⢐⢐⢐⢐⠨⠨⢐⠨⢐⠈#{gray}⡾⡽⡽⡮⡯⣧⠀⠀⠀⠀⠀#{reset} ⠀⠀⠀⠀⠀⠀⠠⠠⢐⢐⢐⢐⢐⠨⠨⢐⠨⢐⠈#{bold}#{gray}⡾⡽⡽⡮⡯⣧⠀⠀⠀⠀⠀#{reset}
⠀⠀⠀⠀⠀⠌⠌⠌⡐⡐⡐⡐⡐⠨⠨⢐⠨⢐⠠⠡⢉#{gray}⢫⢯⠻⠊⠀⠀⠀⠀⠀#{reset} ⠀⠀⠀⠀⠀⠌⠌⠌⡐⡐⡐⡐⡐⠨⠨⢐⠨⢐⠠⠡⢉#{bold}#{gray}⢫⢯⠻⠊⠀⠀⠀⠀⠀#{reset}
⠀⠀⠀⠀⠀⠡⠡⢁⢂⢂#{yellow}⢢⡒⡎#{reset}⠌⠌⡐⠨⢐⠨⠨⢐⢐⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠡⠡⢁⢂⢂#{bold}#{yellow}⢢⡒⡎#{reset}⠌⠌⡐⠨⢐⠨⠨⢐⢐⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠁⠂⠂#{yellow}⡂⡇⡇⡖#{reset}⠡⠁⠂⠅⠂⠌⠌⠐⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠁⠂⠂#{bold}#{yellow}⡂⡇⡇⡖#{reset}⠡⠁⠂⠅⠂⠌⠌⠐⠀⠀⠀⠀⠀⠀⠀⠀⠀
#{yellow}⠀⡜⠌⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ #{bold}#{yellow}⠀⡜⠌⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀#{reset} ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀#{reset}"
"
elsif id == 1066 || id == 1069 || id == 1114 || id == 1117 || id == 1204 || id == 1207 || id == 1210 || id == 1213 || id == 1216 || id == 1219 || id == 1222 || id == 1225 || id == 1237 elsif id == 1066 || id == 1069 || id == 1114 || id == 1117 || id == 1204 || id == 1207 || id == 1210 || id == 1213 || id == 1216 || id == 1219 || id == 1222 || id == 1225 || id == 1237
puts " puts "#{bold}
⡀⢠⡄⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⡀⢠⡄⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⢦⠌⠫⡮⡧⠏⢡⢦⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⢦⠌⠫⡮⡧⠏⢡⢦⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⡈⡻⣺⢧⣀⡸⣇⢠⣸⣳⢝⡁⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⡈⡻⣺⢧⣀⡸⣇⢠⣸⣳⢝⡁⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣘⣉⢁⠉⣞⡍⡘⣽⠀⢁⢉⡃⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣘⣉⢁⠉⣞⡍⡘⣽⠀⢁⢉⡃⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⡈⣕⢯⡏⠃⢻⡊⠉⢯⢯⢏⡁⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⡈⣕⢯⡏⠃⢻⡊⠉⢯⢯⢏⡁⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⢞⢆⣜⢮⡻⣤⠘⠧⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⢞⢆⣜⢮⡻⣤⠘⠧⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠘⠇⠈⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠘⠇⠈⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀#{reset}"
"
elsif id == 1030 || id == 1135 || id == 1147 elsif id == 1030 || id == 1135 || id == 1147
puts " puts "#{bold}#{gray}
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠙⠙⠙⠙⠑⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠙⠙⠙⠙⠑⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠈⠋⠋⠋⡋⡋⡋⡋⡋⡋⡃⡀⡀⡀⡀⡀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠈⠋⠋⠋⡋⡋⡋⡋⡋⡋⡃⡀⡀⡀⡀⡀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⡀⡀⡀⡀⡉⡉⡉⡉⡉⡉⡉⡉⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⡀⡀⡀⡀⡉⡉⡉⡉⡉⡉⡉⡉⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠉⠉⣉⣉⣉⣉⣉⣉⣉⣉⣉⣉⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠉⠉⣉⣉⣉⣉⣉⣉⣉⣉⣉⣉⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⣌⣌⣌⣌⣌⣌⣌⣌⠈⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⣌⣌⣌⣌⣌⣌⣌⣌⠈⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀#{reset}"
"
end end
end end

View File

@@ -1,51 +0,0 @@
orange = "\e[38;5;214m"
red = "\e[0;31m"
bold = "\033[1m"
reset = "\e[0m"
lib C
fun getuid : UInt32
end
if C.getuid != 0
puts "#{red}#{bold}You must be in root to install wfetch!#{reset}"
exit(0)
end
sudo_user = ENV["SUDO_USER"]?
home = "/home/#{sudo_user}"
puts "#{orange}#{bold}wfetch installer 0.1.0#{reset}"
File.copy("data/wfetch", "/usr/bin/wfetch")
puts "#{orange}#{bold}Finished installing! Let's setup.#{reset}"
puts "Please enter your WeatherApi key (Learn to get one at README.md):"
api = gets
puts "Please enter the (closest) city you live in: "
city = gets
puts "#{orange}#{bold}Config setup finished. Starting disp setup.#{reset}"
File.write("/home/#{sudo_user}/.local/share/Wfetch/config.toml", "api = \"#{api}\"
city = \"#{city}\"")
puts "#{orange}#{bold}Would you like customary (1), metric (2), or both (3)?#{reset}"
choice = gets
if choice == "1"
File.copy("data/1.toml", "/home/#{sudo_user}/.local/share/Wfetch/disp.toml")
elsif choice == "2"
File.copy("data/2.toml", "/home/#{sudo_user}/.local/share/Wfetch/disp.toml")
elsif choice == "3"
File.copy("data/3.toml", "/home/#{sudo_user}/.local/share/Wfetch/disp.toml")
else
File.copy("data/1.toml", "/home/#{sudo_user}/.local/share/Wfetch/disp.toml")
end
puts "#{orange}#{bold}Install finnished. Enjoy!#{reset}"

94
src/wf-tool.cr Normal file
View File

@@ -0,0 +1,94 @@
require "option_parser"
orange = "\e[38;5;214m"
red = "\e[0;31m"
bold = "\033[1m"
reset = "\e[0m"
sudo_user = ENV["SUDO_USER"]?
home = "/home/#{sudo_user}"
OptionParser.parse do |parser|
parser.banner = "Usage: wf-tool [arguments]"
parser.on("-i", "--install-only", "Only instals wfetch; Does not run setup") {
if LibC.getuid != 0
puts "#{red}#{bold}You must be in root to install wfetch!#{reset}"
exit(0)
end
puts "#{orange}#{bold}wfetch installer#{reset}"
File.copy("data/wfetch", "/usr/bin/wfetch")
puts "#{orange}#{bold}Finished installing!#{reset}"
exit
}
parser.on("-u", "--uninstall", "Uninstalls wfetch"){
if LibC.getuid != 0
puts "#{red}#{bold}You must be in root to uninstall wfetch!#{reset}"
exit(0)
end
File.delete("/usr/bin/wfetch")
File.delete("#{home}/.local/share/Wfetch/disp.toml")
File.delete("#{home}/.local/share/Wfetch/config.toml")
Dir.delete("#{home}/.local/share/Wfetch")
puts "#{bold}#{orange}Finished#{reset}"
exit
}
parser.on("-s", "--setup", "Runs setup") {
if LibC.getuid == 0
puts "#{red}#{bold}Don't run the setup in root!#{reset}"
exit(0)
end
Dir.mkdir(Path["~/.local/share/Wfetch"].expand(home: true))
puts "Please enter your WeatherApi key (Learn to get one at README.md):"
api = gets
puts "Please enter the (closest) city you live in: "
city = gets
puts "#{orange}#{bold}Config setup finished. Starting disp setup.#{reset}"
File.write(Path["~/.local/share/Wfetch/config.toml"].expand(home: true), "
api = \"#{api}\"
city = \"#{city}\"
")
puts "#{orange}#{bold}Would you like customary (1), metric (2), or both (3)?#{reset}"
choice = gets
if choice == "1"
File.copy("data/1.toml", Path["~/.local/share/Wfetch/disp.toml"].expand(home: true))
elsif choice == "2"
File.copy("data/2.toml", Path["~/.local/share/Wfetch/disp.toml"].expand(home: true))
elsif choice == "3"
File.copy("data/3.toml", Path["~/.local/share/Wfetch/disp.toml"].expand(home: true))
else
File.copy("data/1.toml", Path["~/.local/share/Wfetch/disp.toml"].expand(home: true))
end
puts "#{orange}#{bold}Setup finnished. Enjoy!#{reset}"
exit
}
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
if ARGV.empty?
puts "Run wf-tool -h"
end

View File

@@ -5,15 +5,14 @@ require "./icon-list"
require "option_parser" require "option_parser"
module Wfetch module Wfetch
VERSION = "0.1.0" VERSION = "1.0.0"
orange = "\e[38;5;214m" orange = "\e[38;5;214m"
red = "\e[0;31m" red = "\e[0;31m"
bold = "\033[1m" bold = "\e[1m"
reset = "\e[0m" reset = "\e[0m"
puts "#{bold}#{orange}Wfetch KoffeeJava 2026#{reset}"
debug = false debug = false
test_config = false
OptionParser.parse do |parser| OptionParser.parse do |parser|
parser.banner = "Usage: wfetch [arguments]" parser.banner = "Usage: wfetch [arguments]"
@@ -29,9 +28,15 @@ module Wfetch
print "End" print "End"
exit(1) exit(1)
} }
parser.on("-v", "--verbose", "Gives additional details.") {debug = true} parser.on("-d", "--debug", "Turns on debug mode.") {debug = true}
parser.on("-t", "--test-disp-config", "Test a disp config without editing yours.") {
test_config = true
}
parser.on("-v", "--version", "Shows the current version of wfetch") {
puts "#{bold}#{orange}Wfetch 1.0.0 KoffeeJava 2026#{reset}"
exit
}
parser.on("-h", "--help", "Show this help") do parser.on("-h", "--help", "Show this help") do
puts parser puts parser
exit(1) exit(1)
end end
@@ -42,7 +47,7 @@ module Wfetch
end end
end end
print "#{bold}#{orange}Wfetch KoffeeJava 2026#{reset}"
config = TOML.parse(File.read(Path["~/.local/share/Wfetch/config.toml"].expand(home: true))) config = TOML.parse(File.read(Path["~/.local/share/Wfetch/config.toml"].expand(home: true)))
city = config["city"] city = config["city"]
@@ -58,32 +63,118 @@ module Wfetch
data = JSON.parse(response.body.lines.join) data = JSON.parse(response.body.lines.join)
if debug == true if debug == true
puts data puts "\n#{data}"
end end
feelslike_f = data["current"]["feelslike_f"] feelslike_f = data["current"]["feelslike_f"].to_s.to_f
feelslike_c = data["current"]["feelslike_c"] feelslike_c = data["current"]["feelslike_c"].to_s.to_f
temp_f = data["current"]["temp_f"] temp_f = data["current"]["temp_f"].to_s.to_f
temp_c = data["current"]["temp_c"] temp_c = data["current"]["temp_c"].to_s.to_f
desc = data["current"]["condition"]["text"] desc = data["current"]["condition"]["text"].to_s
press_in = data["current"]["pressure_in"] press_in = data["current"]["pressure_in"].to_s.to_f
press_mb = data["current"]["pressure_mb"] press_mb = data["current"]["pressure_mb"].to_s.to_f
wind_mph = data["current"]["wind_mph"] wind_mph = data["current"]["wind_mph"].to_s.to_f
wind_kph = data["current"]["wind_kph"] wind_kph = data["current"]["wind_kph"].to_s.to_f
humidity = data["current"]["humidity"] humidity = data["current"]["humidity"].to_s.to_f
vis_mi = data["current"]["vis_miles"] vis_mi = data["current"]["vis_miles"].to_s.to_f
vis_km = data["current"]["vis_km"] vis_km = data["current"]["vis_km"].to_s.to_f
heatindex_f = data["current"]["heatindex_f"] heatindex_f = data["current"]["heatindex_f"].to_s.to_f
heatindex_c = data["current"]["heatindex_c"] heatindex_c = data["current"]["heatindex_c"].to_s.to_f
windchill_f = data["current"]["windchill_f"] windchill_f = data["current"]["windchill_f"].to_s.to_f
windchill_c = data["current"]["windchill_c"] windchill_c = data["current"]["windchill_c"].to_s.to_f
id = data["current"]["condition"]["code"] id = data["current"]["condition"]["code"]
disp = TOML.parse(File.read(Path["~/.local/share/Wfetch/disp.toml"].expand(home: true))) if debug == true
disp = TOML.parse("
1 = \"{icon}\"
2 = \"Live Temperature: {temp_f_color}{temp_f}{reset}°F\"
3 = \"Live Temperature: {temp_c_color}{temp_c}{reset}°C\"
4 = \"Feels like: {fl_f_color}{feels_like_f}{reset}°F\"
5 = \"Feels like: {fl_c_color}{feels_like_c}{reset}°C\"
6 = \"Wind Speed: {wind_mph_color}{wind_mph}{reset} MPH\"
7 = \"Wind Speed: {wind_kph_color}{wind_kph}{reset} KPH\"
8 = \"Humidity: {humidity}%\"
9 = \"Pressure: {pressure_in} IN\"
10 = \"Pressure: {pressure_mb} MB\"
11 = \"Description: {orange}{bold}{description}{reset}\"
12 = \"{goodbye}\"
")
elsif test_config
puts "\nPlease paste the path of the config"
path_config = gets
disp = TOML.parse(File.read(Path["#{path_config}"].expand(home: true)))
else
disp = TOML.parse(File.read(Path["~/.local/share/Wfetch/disp.toml"].expand(home: true)))
end
repeat = 1 repeat = 1
if Time.local.minute < 10
time = (Time.local.hour.to_s + 0.to_s + Time.local.minute.to_s).to_f
if time < 1200
message = "#{bold}#{orange}Have a good morning!#{reset}"
elsif time >= 1200
message = "#{bold}#{orange}Have a good afternoon!#{reset}"
end
elsif Time.local.minute >= 10
time = (Time.local.hour.to_s + Time.local.minute.to_s).to_f
if time < 1200
message = "#{bold}#{orange}Have a good morning!#{reset}"
elsif time >= 1200
message = "#{bold}#{orange}Have a good afternoon!#{reset}"
end
end
if feelslike_f > 85
fl_f_color = bold + red
elsif (70..84).includes?(feelslike_f)
fl_f_color = bold + "\e[1;33m"
elsif feelslike_f < 70
fl_f_color = "\e[0;34m" + bold
end
if feelslike_c > 29
fl_c_color = bold + red
elsif (21..28).includes?(feelslike_c)
fl_c_color = bold + "\e[1;33m"
elsif feelslike_c < 21
fl_c_color = "\e[0;34m" + bold
end
if temp_f > 85
temp_f_color = bold + red
elsif (70..84).includes?(temp_f)
temp_f_color = bold + "\e[1;33m"
elsif temp_f < 70
temp_f_color = "\e[0;34m" + bold
end
if temp_c > 29
temp_c_color = bold + red
elsif (21..28).includes?(temp_c)
temp_c_color = bold + "\e[1;33m"
elsif temp_c < 21
temp_c_color = "\e[0;34m" + bold
end
if wind_mph > 73
wind_mph_color = bold + red
elsif (13..26).includes?(wind_mph)
wind_mph_color = bold + "\e[1;33m"
elsif (1..12).includes?(wind_mph)
wind_mph_color = "\e[0;34m" + bold
end
if wind_kph > 46
wind_kph_color = bold + red
elsif (20..45).includes?(wind_mph)
wind_kph_color = bold + "\e[1;33m"
elsif (1..19).includes?(wind_mph)
wind_kph_color = "\e[0;34m" + bold
end
vars = { vars = {
"{temp_f}" => temp_f, "{temp_f}" => temp_f,
"{temp_c}" => temp_c, "{temp_c}" => temp_c,
@@ -101,13 +192,19 @@ module Wfetch
"{description}" => desc, "{description}" => desc,
"{orange}" => orange, "{orange}" => orange,
"{bold}" => bold, "{bold}" => bold,
"{fl_f_color}" => fl_f_color,
"{fl_c_color}" => fl_c_color,
"{temp_f_color}" => temp_f_color,
"{temp_c_color}" => temp_c_color,
"{wind_mph_color}" => wind_mph_color,
"{wind_kph_color}" => wind_kph_color,
"{reset}" => reset, "{reset}" => reset,
"{icon}" => nil "{icon}" => nil,
"{goodbye}" => message
} }
File.each_line("/home/koffeejava/.local/share/Wfetch/disp.toml") do |line| File.each_line(Path["~/.local/share/Wfetch/disp.toml"].expand(home: true)) do |line|
entry = disp["#{repeat}"]? entry = disp["#{repeat}"]?
if entry if entry
if entry.to_s == "{icon}" if entry.to_s == "{icon}"
icon(id) icon(id)
@@ -115,7 +212,6 @@ module Wfetch
pattern = Regex.new(vars.keys.map { |k| Regex.escape(k) }.join("|")) pattern = Regex.new(vars.keys.map { |k| Regex.escape(k) }.join("|"))
puts entry.to_s.gsub(pattern, vars) puts entry.to_s.gsub(pattern, vars)
end end
repeat += 1 repeat += 1
end end