24 Commits

Author SHA1 Message Date
koffeejava
0835b41519 Updated wfp-tools to work with portable versions 2026-03-14 20:57:14 -06:00
koffeejava
b4bdd63447 Chnaging version number 2026-03-14 20:49:48 -06:00
koffeejava
93ed81b675 bleb 2026-03-14 20:06:41 -06:00
koffeejava
a1e6ebd3a7 fixed filename 2026-03-14 19:39:20 -06:00
koffeejava
54e57dc71a updated README 2026-03-14 19:37:16 -06:00
koffeejava
3255f402c8 changed icons to be dark after 6:30 pm 2026-03-14 18:28:08 -06:00
koffeejava
07519a2258 Updated wf-tool to not include version of wfetch because it will basicly work with all wfetch versions and changed how wfetch shows json responce in debug mode. 2026-03-14 18:24:55 -06:00
koffeejava
79d3741b44 added wind_mph_color for disp vars 2026-03-14 18:13:14 -06:00
koffeejava
eb38201911 Added wind speed based coloring, and updated debug 2026-03-14 18:12:25 -06:00
koffeejava
39bf1ac5f6 Removed the newline at the lnd of each icon and changed bold ascii excape 2026-03-14 17:35:58 -06:00
koffeejava
d7ff5791db Removed random blank line 2026-03-14 17:14:56 -06:00
koffeejava
1fa2ca678e Updated icons 2026-03-14 17:14:11 -06:00
koffeejava
00eadaf87c Yay I got --test-config works! 2026-03-14 16:54:24 -06:00
koffeejava
82f593626d added tempature based coloring for temps and in the process of adding test-config 2026-03-14 12:36:50 -06:00
koffeejava
5fcc7c5d98 updated readme 2026-03-14 00:41:05 -06:00
koffeejava
b8aaa0be7b don't need this dir anymre 2026-03-13 19:14:58 -06:00
koffeejava
416e3926c1 Updated name in wf-tool and updated shard.yml to make compileing easier 2026-03-13 19:13:39 -06:00
koffeejava
f6ad1e4fea renamed installer to wf-tools. updated wf-tools 2026-03-13 19:07:09 -06:00
koffeejava
132df9d30a Oh My Fucking GOD. WHY DO I KEEP MAKING THESE MISTAKES. Oh yeah I also updated the installer. 2026-03-13 18:57:34 -06:00
koffeejava
b8e1bcf5c8 updated LICENSE 2026-03-13 18:24:28 -06:00
koffeejava
456d170b9b Made the setup not work in root. 2026-03-13 17:55:16 -06:00
koffeejava
b19406a076 fixed formatting in installer and added a goodbye message to wfetch! :) 2026-03-13 16:46:20 -06:00
koffeejava
a1b3b7baf8 Updated version and finished installer. 2026-03-13 11:12:55 -06:00
koffeejava
89c2b85dbc added version check 2026-03-13 10:35:07 -06:00
8 changed files with 236 additions and 138 deletions

View File

@@ -1,6 +1,6 @@
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
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
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
### 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.
Make sure to paste that api key to setup.
### 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

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

@@ -7,6 +7,9 @@ authors:
targets:
wfetch:
main: src/wfetch.cr
wfp-tool:
main: src/wfp-tool.cr
crystal: '>= 1.19.1'

View File

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

View File

@@ -5,15 +5,14 @@ require "./icon-list"
require "option_parser"
module Wfetch
VERSION = "0.1.0"
VERSION = "1.1.0"
orange = "\e[38;5;214m"
red = "\e[0;31m"
bold = "\033[1m"
bold = "\e[1m"
reset = "\e[0m"
puts "#{bold}#{orange}Wfetch KoffeeJava 2026#{reset}"
debug = false
test_config = false
OptionParser.parse do |parser|
parser.banner = "Usage: wfetch [arguments]"
@@ -29,9 +28,15 @@ module Wfetch
print "End"
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.1.0 KoffeeJava 2026#{reset}"
exit
}
parser.on("-h", "--help", "Show this help") do
puts parser
exit(1)
end
@@ -42,7 +47,7 @@ module Wfetch
end
end
print "#{bold}#{orange}Wfetch KoffeeJava 2026#{reset}"
config = TOML.parse(File.read(Path["~/.local/share/Wfetch/config.toml"].expand(home: true)))
city = config["city"]
@@ -58,32 +63,118 @@ module Wfetch
data = JSON.parse(response.body.lines.join)
if debug == true
puts data
puts "\n#{data}"
end
feelslike_f = data["current"]["feelslike_f"]
feelslike_c = data["current"]["feelslike_c"]
temp_f = data["current"]["temp_f"]
temp_c = data["current"]["temp_c"]
desc = data["current"]["condition"]["text"]
press_in = data["current"]["pressure_in"]
press_mb = data["current"]["pressure_mb"]
wind_mph = data["current"]["wind_mph"]
wind_kph = data["current"]["wind_kph"]
humidity = data["current"]["humidity"]
vis_mi = data["current"]["vis_miles"]
vis_km = 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"]
feelslike_f = data["current"]["feelslike_f"].to_s.to_f
feelslike_c = data["current"]["feelslike_c"].to_s.to_f
temp_f = data["current"]["temp_f"].to_s.to_f
temp_c = data["current"]["temp_c"].to_s.to_f
desc = data["current"]["condition"]["text"].to_s
press_in = data["current"]["pressure_in"].to_s.to_f
press_mb = data["current"]["pressure_mb"].to_s.to_f
wind_mph = data["current"]["wind_mph"].to_s.to_f
wind_kph = data["current"]["wind_kph"].to_s.to_f
humidity = data["current"]["humidity"].to_s.to_f
vis_mi = data["current"]["vis_miles"].to_s.to_f
vis_km = data["current"]["vis_km"].to_s.to_f
heatindex_f = data["current"]["heatindex_f"].to_s.to_f
heatindex_c = data["current"]["heatindex_c"].to_s.to_f
windchill_f = data["current"]["windchill_f"].to_s.to_f
windchill_c = data["current"]["windchill_c"].to_s.to_f
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
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 = {
"{temp_f}" => temp_f,
"{temp_c}" => temp_c,
@@ -101,13 +192,19 @@ module Wfetch
"{description}" => desc,
"{orange}" => orange,
"{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,
"{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}"]?
if entry
if entry.to_s == "{icon}"
icon(id)
@@ -115,7 +212,6 @@ module Wfetch
pattern = Regex.new(vars.keys.map { |k| Regex.escape(k) }.join("|"))
puts entry.to_s.gsub(pattern, vars)
end
repeat += 1
end

40
src/wfp-tool.cr Normal file
View File

@@ -0,0 +1,40 @@
orange = "\e[38;5;214m"
red = "\e[0;31m"
bold = "\033[1m"
reset = "\e[0m"
Dir.mkdir("config")
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("config/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", "config/disp.toml")
elsif choice == "2"
File.copy("data/2.toml", "config/disp.toml")
elsif choice == "3"
File.copy("data/3.toml", "config/disp.toml")
else
File.copy("data/1.toml", "config/disp.toml")
end
puts "#{orange}#{bold}Setup finnished. Enjoy!#{reset}"
Dir.remove("data")