Compare commits
23 Commits
v0.1.0-pre
...
portable
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0835b41519 | ||
|
|
b4bdd63447 | ||
|
|
93ed81b675 | ||
|
|
a1e6ebd3a7 | ||
|
|
54e57dc71a | ||
|
|
3255f402c8 | ||
|
|
07519a2258 | ||
|
|
79d3741b44 | ||
|
|
eb38201911 | ||
|
|
39bf1ac5f6 | ||
|
|
d7ff5791db | ||
|
|
1fa2ca678e | ||
|
|
00eadaf87c | ||
|
|
82f593626d | ||
|
|
5fcc7c5d98 | ||
|
|
b8aaa0be7b | ||
|
|
416e3926c1 | ||
|
|
f6ad1e4fea | ||
|
|
132df9d30a | ||
|
|
b8e1bcf5c8 | ||
|
|
456d170b9b | ||
|
|
b19406a076 | ||
|
|
a1b3b7baf8 |
2
LICENSE
2
LICENSE
@@ -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
|
||||
|
||||
37
README.md
37
README.md
@@ -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
|
||||
|
||||
|
||||
@@ -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}"
|
||||
@@ -7,6 +7,9 @@ authors:
|
||||
targets:
|
||||
wfetch:
|
||||
main: src/wfetch.cr
|
||||
|
||||
wfp-tool:
|
||||
main: src/wfp-tool.cr
|
||||
|
||||
crystal: '>= 1.19.1'
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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}"
|
||||
150
src/wfetch.cr
150
src/wfetch.cr
@@ -5,13 +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"
|
||||
|
||||
debug = false
|
||||
test_config = false
|
||||
|
||||
OptionParser.parse do |parser|
|
||||
parser.banner = "Usage: wfetch [arguments]"
|
||||
@@ -27,13 +28,15 @@ module Wfetch
|
||||
print "End"
|
||||
exit(1)
|
||||
}
|
||||
parser.on("-r", "--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 0.1.0 KoffeeJava 2026#{reset}"
|
||||
puts "#{bold}#{orange}Wfetch 1.1.0 KoffeeJava 2026#{reset}"
|
||||
exit
|
||||
}
|
||||
parser.on("-h", "--help", "Show this help") do
|
||||
|
||||
puts parser
|
||||
exit(1)
|
||||
end
|
||||
@@ -60,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,
|
||||
@@ -103,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)
|
||||
@@ -117,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
40
src/wfp-tool.cr
Normal 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")
|
||||
Reference in New Issue
Block a user