Macchina-CLI / macchina

A system information frontend with an emphasis on performance.
https://crates.io/crates/macchina
MIT License
1.49k stars 52 forks source link

[BUG] Config cannot be found #242

Closed FantasyTeddy closed 2 years ago

FantasyTeddy commented 2 years ago

Describe the bug I updated to Version 6.0.1 today and it appears that my config cannot be found. (Located at: ~\AppData\Roaming\macchina\macchina.toml) Any customization from my config is not loaded and the default theme is displayed. I also do not get an error message that my config is invalid...

System Information

grtcdr commented 2 years ago

Configuration loading is getting on my nerves >:(

I'll have a look at what's causing it to break

FantasyTeddy commented 2 years ago

Sorry, I didn't mean to hit a sore spot :(

grtcdr commented 2 years ago

That's okay, I hope we can fix these kinds of issues once and for all.

grtcdr commented 2 years ago

Can you give v6.0.2 a try?

It's supposed to ease how configuration is handled internally to avoid bugs like this one.

FantasyTeddy commented 2 years ago

Unfortunately, the behavior in v6.0.2 is exactly the same...

After some investigation, it looks like the culprit may be config_dir() where the HOME environment variable is read. This does not seem to work on Windows and should probably also not be necessary? Let me know if I can help with any further information.

grtcdr commented 2 years ago

You're right, extra::config_dir() does not cover Windows, no idea how that one slipped off the radar while I was refactoring.

You're welcome to fix it if you'd like, otherwise, we'll add it the 6.1.0 milestone and fix it ASAP :)

Steccah commented 2 years ago

I have the same issue I am in version 6.0.1 image

grtcdr commented 2 years ago

Sorry to hear that @McStecca

v6.1(that is supposed to fix these issues once and for all) is stalling due to some backend work going on in libmacchina. Can you try building from the v6.0.2 branch?

Can you show me your config and the theme that's being used?

Steccah commented 2 years ago

(built from v6.0.2 branch) Mmh ok, it works now But there is something wrong, the only theme i can use is the default Helium. The only differences form the one i was using are the custom ascci art (working if i add it on helium) and the colors. If in the colors i make everything "Yellow" it works, but if i make something "Orange" it doesn't recognize it no more.

grtcdr commented 2 years ago

Can you provide me with the theme file with the changes you want applied (that it isn't recognizing)?

Steccah commented 2 years ago

Not recognized:

hide_ascii = false
prefer_small_ascii = false
spacing = 2
padding = 0
separator = "->"
key_color = "Red"
separator_color = "Orange"

[bar]
glyph = "o"
symbol_open = "("
symbol_close = ")"
visible = false

[box]
title = "-< Info >-"
visible = true

[box.inner_margin]
x = 2
y = 1

[custom_ascii]
color = "Cyan"
# Uncomment to use your own ASCII art.
path = "/home/stecca/.config/macchina/themes/arch1"

[randomize]
key_color = false
separator_color = false

[keys]
host = "Host"
kernel = "Kernel"
battery = "Battery"
os = "OS"
de = "DE"
wm = "WM"
distro = "Distro"
terminal = "Terminal"
shell = "Shell"
packages = "Packages"
uptime = "Uptime"
memory = "Memory"
machine = "Machine"
local_ip = "IP"
backlight = "Brightness"
resolution = "Resolution"
cpu_load = "CPU Load"
cpu = "CPU"

Recogized:

hide_ascii = false
prefer_small_ascii = false
spacing = 2
padding = 0
separator = "->"
key_color = "Red"
separator_color = "Yellow"

[bar]
glyph = "o"
symbol_open = "("
symbol_close = ")"
visible = false

[box]
title = "-< Info >-"
visible = true

[box.inner_margin]
x = 2
y = 1

[custom_ascii]
color = "Cyan"
# Uncomment to use your own ASCII art.
path = "/home/stecca/.config/macchina/themes/arch1"

[randomize]
key_color = false
separator_color = false

[keys]
host = "Host"
kernel = "Kernel"
battery = "Battery"
os = "OS"
de = "DE"
wm = "WM"
distro = "Distro"
terminal = "Terminal"
shell = "Shell"
packages = "Packages"
uptime = "Uptime"
memory = "Memory"
machine = "Machine"
local_ip = "IP"
backlight = "Brightness"
resolution = "Resolution"
cpu_load = "CPU Load"
cpu = "CPU"
Steccah commented 2 years ago

To be fair in the theme documentation there is no orange but before 6.0.1 it was working anyway

grtcdr commented 2 years ago

@McStecca Yeah, I can reproduce this.

This is very weird, seems like the color deserialization is having issues with "Yellow" in particular.

@uttarayan21 I think we should have a look at color-to-tui to see what's going wrong.

uttarayan21 commented 2 years ago

tui::style::Color doesn't have an Orange So I didn't deserialize Orange https://github.com/fdehau/tui-rs/blob/master/src/style.rs#L7-L27

uttarayan21 commented 2 years ago

To be fair in the theme documentation there is no orange but before 6.0.1 it was working anyway

Hmm I'm not sure how that'd work. Maybe @grtcdr added a Orange deserialization which resolved to an Rgb(r,g,b) ? Anyway the good news is now you can use hex colors like #FFA500

grtcdr commented 2 years ago

tui::style::Color doesn't have an Orange

Oh, I didn't realize that! And you're right, terminals don't have a dedicated color for Orange. I'll include a list of useable colors in the manpages.

grtcdr commented 2 years ago

Hey @FantasyTeddy, is this still an issue with the latest v6.0.3?

FantasyTeddy commented 2 years ago

No, everything works again as expected :)