From 89c2b85dbc970f7d041e82b4f6f51726df38d813 Mon Sep 17 00:00:00 2001 From: koffeejava Date: Fri, 13 Mar 2026 10:35:07 -0600 Subject: [PATCH 01/22] added version check --- src/wfetch.cr | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/wfetch.cr b/src/wfetch.cr index 5b97f73..17eafe8 100644 --- a/src/wfetch.cr +++ b/src/wfetch.cr @@ -11,8 +11,6 @@ module Wfetch bold = "\033[1m" reset = "\e[0m" - puts "#{bold}#{orange}Wfetch KoffeeJava 2026#{reset}" - debug = false OptionParser.parse do |parser| @@ -29,7 +27,11 @@ module Wfetch print "End" exit(1) } - parser.on("-v", "--verbose", "Gives additional details.") {debug = true} + parser.on("-r", "--verbose", "Gives additional details.") {debug = true} + parser.on("-v", "--version", "Shows the current version of wfetch") { + puts "#{bold}#{orange}Wfetch 0.1.0 KoffeeJava 2026#{reset}" + exit + } parser.on("-h", "--help", "Show this help") do puts parser @@ -42,7 +44,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"] From a1b3b7baf8ae918211cdd81498cf60ae5d914c1a Mon Sep 17 00:00:00 2001 From: koffeejava Date: Fri, 13 Mar 2026 11:12:55 -0600 Subject: [PATCH 02/22] Updated version and finished installer. --- src/installer.cr | 68 +++++++++++++++++++++++++++++++++++++++++++++++- src/wfetch.cr | 4 +-- 2 files changed, 69 insertions(+), 3 deletions(-) diff --git a/src/installer.cr b/src/installer.cr index 0583669..b23aaa3 100644 --- a/src/installer.cr +++ b/src/installer.cr @@ -1,3 +1,5 @@ +require "option_parser" + orange = "\e[38;5;214m" red = "\e[0;31m" bold = "\033[1m" @@ -15,7 +17,71 @@ end sudo_user = ENV["SUDO_USER"]? home = "/home/#{sudo_user}" -puts "#{orange}#{bold}wfetch installer 0.1.0#{reset}" +OptionParser.parse do |parser| + parser.banner = "Usage: installer [arguments]" + parser.on("-i", "--install-only", "Only instals wfetch; Does not run setup") { + puts "#{orange}#{bold}wfetch installer 1.0.0#{reset}" + + File.copy("data/wfetch", "/usr/bin/wfetch") + + puts "#{orange}#{bold}Finished installing!#{reset}" + exit + } + parser.on("-u", "--uninstall", "Uninstalls wfetch"){ + 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") { + Dir.mkdir("/home/#{sudo_user}/.local/share/Wfetch") + + + 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}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 + +puts "#{orange}#{bold}wfetch installer 1.0.0#{reset}" File.copy("data/wfetch", "/usr/bin/wfetch") diff --git a/src/wfetch.cr b/src/wfetch.cr index 17eafe8..65de2a0 100644 --- a/src/wfetch.cr +++ b/src/wfetch.cr @@ -5,7 +5,7 @@ require "./icon-list" require "option_parser" module Wfetch - VERSION = "0.1.0" + VERSION = "1.0.0" orange = "\e[38;5;214m" red = "\e[0;31m" bold = "\033[1m" @@ -29,7 +29,7 @@ module Wfetch } parser.on("-r", "--verbose", "Gives additional details.") {debug = 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.0.0 KoffeeJava 2026#{reset}" exit } parser.on("-h", "--help", "Show this help") do From b19406a0763b794dec49da35749366d271535924 Mon Sep 17 00:00:00 2001 From: koffeejava Date: Fri, 13 Mar 2026 16:46:20 -0600 Subject: [PATCH 03/22] fixed formatting in installer and added a goodbye message to wfetch! :) --- src/installer.cr | 3 ++- src/wfetch.cr | 22 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/installer.cr b/src/installer.cr index b23aaa3..28f3a83 100644 --- a/src/installer.cr +++ b/src/installer.cr @@ -97,7 +97,8 @@ city = gets puts "#{orange}#{bold}Config setup finished. Starting disp setup.#{reset}" -File.write("/home/#{sudo_user}/.local/share/Wfetch/config.toml", "api = \"#{api}\" +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}" diff --git a/src/wfetch.cr b/src/wfetch.cr index 65de2a0..367415e 100644 --- a/src/wfetch.cr +++ b/src/wfetch.cr @@ -86,6 +86,25 @@ module Wfetch repeat = 1 + if Time.local.minute < 10 + time = (Time.local.hour.to_s + 0.to_s + Time.local.minute.to_s).to_i + + 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_i + if time < 1200 + message = "#{bold}#{orange}Have a good morning!#{reset}" + elsif time >= 1200 + message = "#{bold}#{orange}Have a good afternoon!#{reset}" + end + end + + vars = { "{temp_f}" => temp_f, "{temp_c}" => temp_c, @@ -104,7 +123,8 @@ module Wfetch "{orange}" => orange, "{bold}" => bold, "{reset}" => reset, - "{icon}" => nil + "{icon}" => nil, + "{goodbye}" => message } File.each_line("/home/koffeejava/.local/share/Wfetch/disp.toml") do |line| From 456d170b9b5d953a8688ea78dcb4c264898c6914 Mon Sep 17 00:00:00 2001 From: koffeejava Date: Fri, 13 Mar 2026 17:55:16 -0600 Subject: [PATCH 04/22] Made the setup not work in root. --- src/installer.cr | 57 +++++++++++++++--------------------------------- 1 file changed, 17 insertions(+), 40 deletions(-) diff --git a/src/installer.cr b/src/installer.cr index 28f3a83..8134ebe 100644 --- a/src/installer.cr +++ b/src/installer.cr @@ -9,17 +9,17 @@ 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}" OptionParser.parse do |parser| parser.banner = "Usage: installer [arguments]" parser.on("-i", "--install-only", "Only instals wfetch; Does not run setup") { + if C.getuid != 0 + puts "#{red}#{bold}You must be in root to install wfetch!#{reset}" + exit(0) + end + puts "#{orange}#{bold}wfetch installer 1.0.0#{reset}" File.copy("data/wfetch", "/usr/bin/wfetch") @@ -28,6 +28,11 @@ OptionParser.parse do |parser| exit } parser.on("-u", "--uninstall", "Uninstalls wfetch"){ + if C.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") @@ -36,6 +41,11 @@ OptionParser.parse do |parser| exit } parser.on("-s", "--setup", "Runs setup") { + if C.getuid = 0 + puts "#{red}#{bold}Don't run the setup in root!#{reset}" + exit(0) + end + Dir.mkdir("/home/#{sudo_user}/.local/share/Wfetch") @@ -81,38 +91,5 @@ OptionParser.parse do |parser| end end -puts "#{orange}#{bold}wfetch installer 1.0.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}" \ No newline at end of file + if ARGV.empty? + puts "Run installer -h" \ No newline at end of file From b8e1bcf5c8fb9d488d5e22f46c2febc72d58cc16 Mon Sep 17 00:00:00 2001 From: koffeejava Date: Fri, 13 Mar 2026 18:24:28 -0600 Subject: [PATCH 05/22] updated LICENSE --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 31593d8..81d866e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2026 koffeejava +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 From 132df9d30ab032f5f0658cc016c491d9a11093b0 Mon Sep 17 00:00:00 2001 From: koffeejava Date: Fri, 13 Mar 2026 18:57:34 -0600 Subject: [PATCH 06/22] Oh My Fucking GOD. WHY DO I KEEP MAKING THESE MISTAKES. Oh yeah I also updated the installer. --- src/installer.cr | 15 ++++++--------- src/wfetch.cr | 22 +++++++++++++++++++--- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/installer.cr b/src/installer.cr index 8134ebe..762bb7b 100644 --- a/src/installer.cr +++ b/src/installer.cr @@ -5,17 +5,13 @@ red = "\e[0;31m" bold = "\033[1m" reset = "\e[0m" -lib C - fun getuid : UInt32 -end - sudo_user = ENV["SUDO_USER"]? home = "/home/#{sudo_user}" OptionParser.parse do |parser| parser.banner = "Usage: installer [arguments]" parser.on("-i", "--install-only", "Only instals wfetch; Does not run setup") { - if C.getuid != 0 + if LibC.getuid != 0 puts "#{red}#{bold}You must be in root to install wfetch!#{reset}" exit(0) end @@ -28,7 +24,7 @@ OptionParser.parse do |parser| exit } parser.on("-u", "--uninstall", "Uninstalls wfetch"){ - if C.getuid != 0 + if LibC.getuid != 0 puts "#{red}#{bold}You must be in root to uninstall wfetch!#{reset}" exit(0) end @@ -41,12 +37,12 @@ OptionParser.parse do |parser| exit } parser.on("-s", "--setup", "Runs setup") { - if C.getuid = 0 + if LibC.getuid == 0 puts "#{red}#{bold}Don't run the setup in root!#{reset}" exit(0) end - Dir.mkdir("/home/#{sudo_user}/.local/share/Wfetch") + Dir.mkdir("~//.local/share/Wfetch") puts "Please enter your WeatherApi key (Learn to get one at README.md):" @@ -92,4 +88,5 @@ OptionParser.parse do |parser| end if ARGV.empty? - puts "Run installer -h" \ No newline at end of file + puts "Run installer -h" + end \ No newline at end of file diff --git a/src/wfetch.cr b/src/wfetch.cr index 367415e..8cdd123 100644 --- a/src/wfetch.cr +++ b/src/wfetch.cr @@ -81,8 +81,24 @@ module Wfetch windchill_c = data["current"]["windchill_c"] 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}°F\" + 3 = \"Live Temperature: {temp_c}°C\" + 4 = \"Feels like: {feels_like_f}°F\" + 5 = \"Feels like: {feels_like_c}°C\" + 6 = \"Wind Speed: {wind_mph} MPH\" + 7 = \"Wind Speed: {wind_kph} KPH\" + 8 = \"Humidity: {humidity}%\" + 9 = \"Pressure: {pressure_in} IN\" + 10 = \"Pressure: {pressure_mb} MB\" + 11 = \"Description: {orange}{bold}{description}{reset}\" + 12 = \"{goodbye}\" + ") + else + disp = TOML.parse(File.read(Path["~/.local/share/Wfetch/disp.toml"].expand(home: true))) + end repeat = 1 @@ -127,7 +143,7 @@ module Wfetch "{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 From f6ad1e4fead73d1de4d0cc7a498bc7dae53b25ed Mon Sep 17 00:00:00 2001 From: koffeejava Date: Fri, 13 Mar 2026 19:07:09 -0600 Subject: [PATCH 07/22] renamed installer to wf-tools. updated wf-tools --- src/{installer.cr => wf-tool.cr} | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) rename src/{installer.cr => wf-tool.cr} (78%) diff --git a/src/installer.cr b/src/wf-tool.cr similarity index 78% rename from src/installer.cr rename to src/wf-tool.cr index 762bb7b..bc7deb3 100644 --- a/src/installer.cr +++ b/src/wf-tool.cr @@ -42,7 +42,7 @@ OptionParser.parse do |parser| exit(0) end - Dir.mkdir("~//.local/share/Wfetch") + Dir.mkdir(Path["~/.local/share/Wfetch"].expand(home: true)) puts "Please enter your WeatherApi key (Learn to get one at README.md):" @@ -55,21 +55,23 @@ OptionParser.parse do |parser| puts "#{orange}#{bold}Config setup finished. Starting disp setup.#{reset}" - File.write("/home/#{sudo_user}/.local/share/Wfetch/config.toml", "api = \"#{api}\" - city = \"#{city}\"") + 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", "/home/#{sudo_user}/.local/share/Wfetch/disp.toml") + File.copy("data/1.toml", Path["~/.local/share/Wfetch/disp.toml"].expand(home: true)) elsif choice == "2" - File.copy("data/2.toml", "/home/#{sudo_user}/.local/share/Wfetch/disp.toml") + File.copy("data/2.toml", Path["~/.local/share/Wfetch/disp.toml"].expand(home: true)) elsif choice == "3" - File.copy("data/3.toml", "/home/#{sudo_user}/.local/share/Wfetch/disp.toml") + File.copy("data/3.toml", Path["~/.local/share/Wfetch/disp.toml"].expand(home: true)) else - File.copy("data/1.toml", "/home/#{sudo_user}/.local/share/Wfetch/disp.toml") + File.copy("data/1.toml", Path["~/.local/share/Wfetch/disp.toml"].expand(home: true)) end puts "#{orange}#{bold}Setup finnished. Enjoy!#{reset}" From 416e3926c114d79333204eb56ebbf0a4217d3816 Mon Sep 17 00:00:00 2001 From: koffeejava Date: Fri, 13 Mar 2026 19:13:39 -0600 Subject: [PATCH 08/22] Updated name in wf-tool and updated shard.yml to make compileing easier --- shard.yml | 3 +++ src/wf-tool.cr | 4 ++-- src/wfetch.cr | 23 +++++++++++------------ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/shard.yml b/shard.yml index c4e0d40..f228d53 100644 --- a/shard.yml +++ b/shard.yml @@ -7,6 +7,9 @@ authors: targets: wfetch: main: src/wfetch.cr + + wf-tool: + main: src/wf-tool.cr crystal: '>= 1.19.1' diff --git a/src/wf-tool.cr b/src/wf-tool.cr index bc7deb3..e4ff3a3 100644 --- a/src/wf-tool.cr +++ b/src/wf-tool.cr @@ -9,7 +9,7 @@ sudo_user = ENV["SUDO_USER"]? home = "/home/#{sudo_user}" OptionParser.parse do |parser| - parser.banner = "Usage: installer [arguments]" + 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}" @@ -90,5 +90,5 @@ OptionParser.parse do |parser| end if ARGV.empty? - puts "Run installer -h" + puts "Run wf-tool -h" end \ No newline at end of file diff --git a/src/wfetch.cr b/src/wfetch.cr index 8cdd123..d9b7eeb 100644 --- a/src/wfetch.cr +++ b/src/wfetch.cr @@ -84,17 +84,17 @@ module Wfetch if debug == true disp = TOML.parse(" 1 = \"{icon}\" - 2 = \"Live Temperature: {temp_f}°F\" - 3 = \"Live Temperature: {temp_c}°C\" - 4 = \"Feels like: {feels_like_f}°F\" - 5 = \"Feels like: {feels_like_c}°C\" - 6 = \"Wind Speed: {wind_mph} MPH\" - 7 = \"Wind Speed: {wind_kph} KPH\" - 8 = \"Humidity: {humidity}%\" - 9 = \"Pressure: {pressure_in} IN\" - 10 = \"Pressure: {pressure_mb} MB\" - 11 = \"Description: {orange}{bold}{description}{reset}\" - 12 = \"{goodbye}\" + 2 = \"Live Temperature: {temp_f}°F\" + 3 = \"Live Temperature: {temp_c}°C\" + 4 = \"Feels like: {feels_like_f}°F\" + 5 = \"Feels like: {feels_like_c}°C\" + 6 = \"Wind Speed: {wind_mph} MPH\" + 7 = \"Wind Speed: {wind_kph} KPH\" + 8 = \"Humidity: {humidity}%\" + 9 = \"Pressure: {pressure_in} IN\" + 10 = \"Pressure: {pressure_mb} MB\" + 11 = \"Description: {orange}{bold}{description}{reset}\" + 12 = \"{goodbye}\" ") else disp = TOML.parse(File.read(Path["~/.local/share/Wfetch/disp.toml"].expand(home: true))) @@ -110,7 +110,6 @@ module Wfetch 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_i if time < 1200 From b8aaa0be7b692be729816ae0df02e8436d6966ed Mon Sep 17 00:00:00 2001 From: koffeejava Date: Fri, 13 Mar 2026 19:14:58 -0600 Subject: [PATCH 09/22] don't need this dir anymre --- disp-configs/customary.toml | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 disp-configs/customary.toml diff --git a/disp-configs/customary.toml b/disp-configs/customary.toml deleted file mode 100644 index 86f911a..0000000 --- a/disp-configs/customary.toml +++ /dev/null @@ -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}" From 5fcc7c5d98ab924442f429b45f4147854478a170 Mon Sep 17 00:00:00 2001 From: koffeejava Date: Sat, 14 Mar 2026 00:41:05 -0600 Subject: [PATCH 10/22] updated readme --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bde0a9f..1c85704 100644 --- a/README.md +++ b/README.md @@ -6,18 +6,24 @@ This version of wfetch is semi-backwards compatible (config.toml will work! But ## Installation -Run the installer executible in root and follow instructions. +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. ## 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 From 82f593626df7c84f23666e03a4ad2a42e08013fb Mon Sep 17 00:00:00 2001 From: koffeejava Date: Sat, 14 Mar 2026 12:36:50 -0600 Subject: [PATCH 11/22] added tempature based coloring for temps and in the process of adding test-config --- src/wfetch.cr | 89 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 66 insertions(+), 23 deletions(-) diff --git a/src/wfetch.cr b/src/wfetch.cr index d9b7eeb..7f1c758 100644 --- a/src/wfetch.cr +++ b/src/wfetch.cr @@ -12,6 +12,7 @@ module Wfetch reset = "\e[0m" debug = false + test_config = false OptionParser.parse do |parser| parser.banner = "Usage: wfetch [arguments]" @@ -27,7 +28,12 @@ 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 + puts "Please paste your config." + config = gets + } parser.on("-v", "--version", "Shows the current version of wfetch") { puts "#{bold}#{orange}Wfetch 1.0.0 KoffeeJava 2026#{reset}" exit @@ -63,31 +69,31 @@ module Wfetch puts 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"] if debug == true disp = TOML.parse(" 1 = \"{icon}\" - 2 = \"Live Temperature: {temp_f}°F\" - 3 = \"Live Temperature: {temp_c}°C\" - 4 = \"Feels like: {feels_like_f}°F\" - 5 = \"Feels like: {feels_like_c}°C\" + 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} MPH\" 7 = \"Wind Speed: {wind_kph} KPH\" 8 = \"Humidity: {humidity}%\" @@ -96,6 +102,8 @@ module Wfetch 11 = \"Description: {orange}{bold}{description}{reset}\" 12 = \"{goodbye}\" ") + elsif test_config + disp = TOML.parse(config.to_s) else disp = TOML.parse(File.read(Path["~/.local/share/Wfetch/disp.toml"].expand(home: true))) end @@ -103,7 +111,7 @@ module Wfetch repeat = 1 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_f if time < 1200 message = "#{bold}#{orange}Have a good morning!#{reset}" @@ -111,7 +119,7 @@ module Wfetch 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_i + 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 @@ -119,6 +127,37 @@ module Wfetch end end + if feelslike_f > 85 + fl_f_color = bold + red + elsif (70..84).includes?(feelslike_f) + fl_f_color = bold + "\e[38;5;208m" + 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[38;5;208m" + 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[38;5;208m" + 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[38;5;208m" + elsif temp_c < 21 + temp_c_color = "\e[0;34m" + bold + end vars = { "{temp_f}" => temp_f, @@ -137,6 +176,10 @@ 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, "{reset}" => reset, "{icon}" => nil, "{goodbye}" => message From 00eadaf87c77b080279ab92b00fe2fc99dcf83d1 Mon Sep 17 00:00:00 2001 From: koffeejava Date: Sat, 14 Mar 2026 16:54:24 -0600 Subject: [PATCH 12/22] Yay I got --test-config works! --- src/wfetch.cr | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/wfetch.cr b/src/wfetch.cr index 7f1c758..485b8a4 100644 --- a/src/wfetch.cr +++ b/src/wfetch.cr @@ -31,15 +31,12 @@ module Wfetch 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 - puts "Please paste your config." - config = gets } 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 - puts parser exit(1) end @@ -103,7 +100,9 @@ module Wfetch 12 = \"{goodbye}\" ") elsif test_config - disp = TOML.parse(config.to_s) + 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 From 1fa2ca678eaa4e406e81dfa03a087000784fd987 Mon Sep 17 00:00:00 2001 From: koffeejava Date: Sat, 14 Mar 2026 17:14:11 -0600 Subject: [PATCH 13/22] Updated icons --- src/icon-list.cr | 60 ++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 33 deletions(-) diff --git a/src/icon-list.cr b/src/icon-list.cr index ee2cf06..e0a840e 100644 --- a/src/icon-list.cr +++ b/src/icon-list.cr @@ -16,7 +16,7 @@ def icon(id) 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" + orange = "\e[38;5;8m" else orange = "\e[38;5;214m" end @@ -52,44 +52,38 @@ 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} ⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⡀⢠⡄⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⢦⠌⠫⡮⡧⠏⢡⢦⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⡈⡻⣺⢧⣀⡸⣇⢠⣸⣳⢝⡁⠀⠀⠀⠀⠀⠀⠀⠀⠀ @@ -97,15 +91,15 @@ def icon(id) ⠀⠀⠀⠀⠀⠀⠀⠀⠀⡈⣕⢯⡏⠃⢻⡊⠉⢯⢯⢏⡁⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⢞⢆⣜⢮⡻⣤⠘⠧⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠘⠇⠈⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - " + #{reset}" elsif id == 1030 || id == 1135 || id == 1147 - puts " + puts "#{bold}#{gray} ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠙⠙⠙⠙⠑⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠈⠋⠋⠋⡋⡋⡋⡋⡋⡋⡃⡀⡀⡀⡀⡀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⡀⡀⡀⡀⡉⡉⡉⡉⡉⡉⡉⡉⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠉⠉⣉⣉⣉⣉⣉⣉⣉⣉⣉⣉⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⣌⣌⣌⣌⣌⣌⣌⣌⠈⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀ - " + #{reset}" end end \ No newline at end of file From d7ff5791db2948a9e609376c95eb18db1bdb880a Mon Sep 17 00:00:00 2001 From: koffeejava Date: Sat, 14 Mar 2026 17:14:56 -0600 Subject: [PATCH 14/22] Removed random blank line --- src/wfetch.cr | 1 - 1 file changed, 1 deletion(-) diff --git a/src/wfetch.cr b/src/wfetch.cr index 485b8a4..8aa6f24 100644 --- a/src/wfetch.cr +++ b/src/wfetch.cr @@ -194,7 +194,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 From 39bf1ac5f6ef0edd290b9ae32245d72bbbfd9dbf Mon Sep 17 00:00:00 2001 From: koffeejava Date: Sat, 14 Mar 2026 17:35:58 -0600 Subject: [PATCH 15/22] Removed the newline at the lnd of each icon and changed bold ascii excape --- src/icon-list.cr | 12 ++++-------- src/wfetch.cr | 21 +++++++++++++++------ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/icon-list.cr b/src/icon-list.cr index e0a840e..4c7bcde 100644 --- a/src/icon-list.cr +++ b/src/icon-list.cr @@ -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 " ⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⡐⠨⢐⢐⢐⠨⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ @@ -90,16 +88,14 @@ def icon(id) ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣘⣉⢁⠉⣞⡍⡘⣽⠀⢁⢉⡃⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⡈⣕⢯⡏⠃⢻⡊⠉⢯⢯⢏⡁⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⢞⢆⣜⢮⡻⣤⠘⠧⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ -⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠘⠇⠈⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ - #{reset}" +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠘⠇⠈⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀#{reset}" elsif id == 1030 || id == 1135 || id == 1147 puts "#{bold}#{gray} ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠙⠙⠙⠙⠑⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠈⠋⠋⠋⡋⡋⡋⡋⡋⡋⡃⡀⡀⡀⡀⡀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⡀⡀⡀⡀⡉⡉⡉⡉⡉⡉⡉⡉⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠉⠉⣉⣉⣉⣉⣉⣉⣉⣉⣉⣉⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀ -⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⣌⣌⣌⣌⣌⣌⣌⣌⠈⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀ - #{reset}" +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠈⣌⣌⣌⣌⣌⣌⣌⣌⠈⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀#{reset}" end end \ No newline at end of file diff --git a/src/wfetch.cr b/src/wfetch.cr index 8aa6f24..ea30394 100644 --- a/src/wfetch.cr +++ b/src/wfetch.cr @@ -8,7 +8,7 @@ module Wfetch VERSION = "1.0.0" orange = "\e[38;5;214m" red = "\e[0;31m" - bold = "\033[1m" + bold = "\e[1m" reset = "\e[0m" debug = false @@ -129,7 +129,7 @@ module Wfetch if feelslike_f > 85 fl_f_color = bold + red elsif (70..84).includes?(feelslike_f) - fl_f_color = bold + "\e[38;5;208m" + fl_f_color = bold + "\e[1;33m" elsif feelslike_f < 70 fl_f_color = "\e[0;34m" + bold end @@ -137,7 +137,7 @@ module Wfetch if feelslike_c > 29 fl_c_color = bold + red elsif (21..28).includes?(feelslike_c) - fl_c_color = bold + "\e[38;5;208m" + fl_c_color = bold + "\e[1;33m" elsif feelslike_c < 21 fl_c_color = "\e[0;34m" + bold end @@ -145,7 +145,7 @@ module Wfetch if temp_f > 85 temp_f_color = bold + red elsif (70..84).includes?(temp_f) - temp_f_color = bold + "\e[38;5;208m" + temp_f_color = bold + "\e[1;33m" elsif temp_f < 70 temp_f_color = "\e[0;34m" + bold end @@ -153,11 +153,20 @@ module Wfetch if temp_c > 29 temp_c_color = bold + red elsif (21..28).includes?(temp_c) - temp_c_color = bold + "\e[38;5;208m" + temp_c_color = bold + "\e[1;33m" elsif temp_c < 21 temp_c_color = "\e[0;34m" + bold end + if (26..73).includes?(wind_mph) + wind_mph_color = bold + red + elsif (13..25).includes?(wind_mph) + wind_mph_color = bold + "\e[1;33m" + elsif (1..12).includes?(wind_mph) + wind_mph_color = "\e[0;34m" + bold + end + + vars = { "{temp_f}" => temp_f, "{temp_c}" => temp_c, @@ -179,6 +188,7 @@ module Wfetch "{fl_c_color}" => fl_c_color, "{temp_f_color}" => temp_f_color, "{temp_c_color}" => temp_c_color, + "{wind_mph_color}" => wind_mph_color, "{reset}" => reset, "{icon}" => nil, "{goodbye}" => message @@ -186,7 +196,6 @@ module Wfetch 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) From eb38201911556ac19848f6f37191639f59938134 Mon Sep 17 00:00:00 2001 From: koffeejava Date: Sat, 14 Mar 2026 18:12:25 -0600 Subject: [PATCH 16/22] Added wind speed based coloring, and updated debug --- src/wfetch.cr | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/wfetch.cr b/src/wfetch.cr index ea30394..a7a5b12 100644 --- a/src/wfetch.cr +++ b/src/wfetch.cr @@ -91,13 +91,14 @@ module Wfetch 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} MPH\" - 7 = \"Wind Speed: {wind_kph} KPH\" + 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" @@ -158,14 +159,22 @@ module Wfetch temp_c_color = "\e[0;34m" + bold end - if (26..73).includes?(wind_mph) + if wind_mph > 73 wind_mph_color = bold + red - elsif (13..25).includes?(wind_mph) + 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, From 79d3741b442c16cb0aa90b41548d5a8161f6c833 Mon Sep 17 00:00:00 2001 From: koffeejava Date: Sat, 14 Mar 2026 18:13:14 -0600 Subject: [PATCH 17/22] added wind_mph_color for disp vars --- src/wfetch.cr | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wfetch.cr b/src/wfetch.cr index a7a5b12..67134c2 100644 --- a/src/wfetch.cr +++ b/src/wfetch.cr @@ -198,6 +198,7 @@ module Wfetch "{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, "{goodbye}" => message From 07519a22588aa8c46d10adf3ac64368589e375c2 Mon Sep 17 00:00:00 2001 From: koffeejava Date: Sat, 14 Mar 2026 18:24:55 -0600 Subject: [PATCH 18/22] 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. --- src/wf-tool.cr | 2 +- src/wfetch.cr | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/wf-tool.cr b/src/wf-tool.cr index e4ff3a3..1a68e66 100644 --- a/src/wf-tool.cr +++ b/src/wf-tool.cr @@ -16,7 +16,7 @@ OptionParser.parse do |parser| exit(0) end - puts "#{orange}#{bold}wfetch installer 1.0.0#{reset}" + puts "#{orange}#{bold}wfetch installer#{reset}" File.copy("data/wfetch", "/usr/bin/wfetch") diff --git a/src/wfetch.cr b/src/wfetch.cr index 67134c2..34cacfd 100644 --- a/src/wfetch.cr +++ b/src/wfetch.cr @@ -63,7 +63,7 @@ module Wfetch data = JSON.parse(response.body.lines.join) if debug == true - puts data + puts "\n#{data}" end feelslike_f = data["current"]["feelslike_f"].to_s.to_f @@ -98,7 +98,6 @@ module Wfetch 10 = \"Pressure: {pressure_mb} MB\" 11 = \"Description: {orange}{bold}{description}{reset}\" 12 = \"{goodbye}\" - ") elsif test_config puts "\nPlease paste the path of the config" From 3255f402c845d8510be91eea77b25ab3ca33c1af Mon Sep 17 00:00:00 2001 From: koffeejava Date: Sat, 14 Mar 2026 18:28:08 -0600 Subject: [PATCH 19/22] changed icons to be dark after 6:30 pm --- src/icon-list.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/icon-list.cr b/src/icon-list.cr index 4c7bcde..4202298 100644 --- a/src/icon-list.cr +++ b/src/icon-list.cr @@ -8,14 +8,14 @@ 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 + if time > 1830 orange = "\e[38;5;235m" 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 + if time > 1830 orange = "\e[38;5;8m" else orange = "\e[38;5;214m" From 54e57dc71ab032c1583752279faeb02849fb3532 Mon Sep 17 00:00:00 2001 From: koffeejava Date: Sat, 14 Mar 2026 19:37:16 -0600 Subject: [PATCH 20/22] updated README --- README.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1c85704..ae7ce32 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ This version of wfetch is semi-backwards compatible (config.toml will work! But ## Installation +### 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. @@ -15,6 +17,28 @@ Open your favorite terminal in the folder and run `sudo ./wf-tool -i` This will 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.xz + +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? @@ -25,7 +49,6 @@ First, go to the [Weather API](https://www.weatherapi.com/) website and then sig Giving out an api key is one of the top ten things to never do in your life. - ## Contributing 1. Fork it () From a1e6ebd3a7eb966de8f84751f6e80fcaa51268c5 Mon Sep 17 00:00:00 2001 From: koffeejava Date: Sat, 14 Mar 2026 19:39:20 -0600 Subject: [PATCH 21/22] fixed filename --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ae7ce32..ba17f6b 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ At this time MacOS does not have a build. - Crystal compiler - Wfetch Source Code -- wfetch-1.0.0-data.tar.xz +- 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/ From 93ed81b67596825e633235edb4150798d3cc40f5 Mon Sep 17 00:00:00 2001 From: koffeejava Date: Sat, 14 Mar 2026 20:06:41 -0600 Subject: [PATCH 22/22] bleb --- src/icon-list.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/icon-list.cr b/src/icon-list.cr index 4202298..83c1279 100644 --- a/src/icon-list.cr +++ b/src/icon-list.cr @@ -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" @@ -9,7 +9,7 @@ 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 > 1830 - orange = "\e[38;5;235m" + orange = "\e[38;5;8m" else orange = "\e[38;5;214m" end