-
Notifications
You must be signed in to change notification settings - Fork 521
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
Load configuration from XDG_CONFIG_DIRS #4506
Comments
For anyone that works on this, consider creating an iterator interface similar to the |
It's worth noting that, per the spec, Currently the code in
I think it's worth deciding if ghostty should just use the first directory in Forgot to add: possibly using an external cross-platform library like known-folders is the right call here, but they seem to assume just one configuration directory and not multiple. |
My expectation was we'd read all the directories. I agree that with @jcollie that the proper approach is to implement an iterator for this to avoid unnecessary allocations. |
So to be a little more specific, we need an iterator that returns these directories in this order:
Or should we look at |
I would simplify the problem to start by creating an iterator on its own that just iterates For Also note in your list that step 2 is redundant, because that's the default |
@jcollie If the final config will be a composite of all existing configs, then I believe to allow user to override system-wide values, the directories you mentioned need to be returned in the reverse order:
|
When looking for a single config file, the first one found "wins" right now. So if both |
From the XDG spec
|
Discussed in #4477
Originally posted by vikanezrimaya January 3, 2025
I want to be able to drop a system-wide config for Ghostty into
/etc/xdg
.XDG_CONFIG_DIRS
is a variable listing additional locations for config files that could be checked if the appropriate config in$XDG_CONFIG_HOME
/~/.config
is not found, and by default it includes/etc/xdg
(at least on my distribution of choice).If ghostty would respect this directory (by either loading this config if no config exists in the home directory, or loading it before the user config, allowing user to override system-wide defaults), that would be nice. It looks like ghostty creates an empty default config if it doesn't exist in the home directory, so perhaps the second option is the most appropriate.
Solution
We should load from both
XDG_CONFIG_DIRS
andXDG_CONFIG_HOME
and override along the way.The text was updated successfully, but these errors were encountered: