Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug report] Mac not using .config for default config directory #62

Closed
phantomwhale opened this issue Sep 25, 2024 · 5 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@phantomwhale
Copy link
Contributor

Describe the bug

The default configuration file location on MacOS isn't working as per the documentation, it's using a MacOS Library location that isn't commonly used for CLI config files

(Unsure if a bug or an issue - apologies if this isn't in the best category!)

Expected behavior

Assuming that XDG_CONFIG_HOME env variable has not been set, the default configuration file location should be ~/.config/tinted-theming/tinty/config.toml

Screenshots

CleanShot 2024-09-25 at 17 29 11

System

Operating system: MacOS 14.5

Terminal: Kitty

Minimal configuration file

Ironically, I don't think the config file matters here, given tinty isn't finding / using it 😬

Additional context

I did a little digging around to see if I could understand this better.

I found a similar problem / solution in another Rust project here - nushell/nushell#8682

My understanding is the directories library has drawn the line under this as "not a bug" - dirs-dev/directories-rs#47 (comment)

Nonetheless, I don't seem to have hit this issue with other tooling; and note the above PR moved to another directory crate to remedy this issue.

I'm not a Rust developer, so hard for me to dig much deeper, but thanks for your review and consideration

@phantomwhale phantomwhale added the bug Something isn't working label Sep 25, 2024
@phantomwhale
Copy link
Contributor Author

phantomwhale commented Sep 25, 2024

Briefly thought - oh wait, why don't I just set the XDG var as a simple workaround!

But apparently this doesn't work either:

CleanShot 2024-09-25 at 17 37 20

EDIT - oh right, reading the issue shared above, it was never going to work. Looks like the dirs project is locked into that being the "right and only place" for Mac CLI config to live, and no support for config in home dirs. Can't say I understand how they've come to that hard line, but it's certainly not a "developer dotfiles"-compatible approach.

@JamyGolden
Copy link
Member

JamyGolden commented Sep 25, 2024

Thanks for creating the issue. I will create an override for this dirs behaviour since your idea above makes sense to me: If XDG vars are set, it should pick that up and use that. I'll work on it this week and let you know when I've added that.

What you can do in the meantime is to add this in your .zshrc file:

config_path="$XDG_CONFIG_HOME/tinted-theming/tinty/config.toml"
data_path="$XDG_DATA_HOME/tinted-theming/tinty"

alias tinty="tinty --config=\"$config_path\" --data-dir=\"$data_path\""

unset config_path data_path

--config and --data-dir allows you to override the default values used by dirs

@phantomwhale
Copy link
Contributor Author

phantomwhale commented Sep 26, 2024

Ah yeah, didn't think about setting an alias! (line 3 needs the prefix alias incase anyone else is copying the snippet above)

Don't think it's typical for MacOS developers to have the XDG_* vars set, so I dare say others might come across this issue; certainly many other tools I use (bat, neovim, yabai, kitty, gh) all seem to "default" to use ~/.config without any extra setup.

So ideally the Mac version of the tool would just default to use .config as well (which appears to be the behaviour of the etcetera Rust libarary).

But the above workaround and an override of dirs to pickup the XDG_ vars would work just as well for me; can't see any harm in having those env vars set in general.

Thanks for your help, much appreciated, and looking forward to pull out a bunch of ansible (to clone base16 git repos) and dotfiles and replace it all with tinty!

@JamyGolden
Copy link
Member

JamyGolden commented Sep 28, 2024

I've created a PR here, I'll leave it up for a day or so and merge if no one has any comments.

@JamyGolden
Copy link
Member

Just merged, let me know if you run in to any bugs with it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants