-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Support .config
/XDG configuration location in MacOSX
#1341
Comments
I think we are not going to make the above the default because:
If we would start over i think Nevertheless you should be able to set Have you tried setting |
I'm cool to support this, we'd just need to find a way to make it backwards compatible. I don't really like the idea of us moving the current config files to a different directory upon lazygit being updated, but am willing to be persuaded that's actually a good move. If we don't go ahead with a migration, we could use the following rules:
As @mjarkk says you can use the CONFIG_DIR env variable to set the directory as Lemme know your thoughts |
No, I use a variable in my Ansible scripts that is set per host: https://github.com/briandipalma/ansible/blob/main/roles/common/tasks/lazygit.yml#L16 I prefer to keep my shell config clean and lean on Ansible to deal with machine/workstation variations where possible. This works fine but I can imagine other users may want to symlink a bunch of directories into I think the rules @jesseduffield describes make sense, personally I have to dig around/google to find the correct paths in MacOSX while I know I mean |
Since I am managing all my dot files with stow it would be great to be able to include the lazygit configuration here as well. Any plans on supporting the config folder next to the Application Support location? |
I think by now it's the default for most apps to have the config in the |
Sorry for not getting back to this thread in a while. I'm currently working on some refactoring but will happily review a PR implementing the above approach (i.e. #1341 (comment)) (using the backwards-compatible approach) |
Currently lazygit looks for its config file in `XDG_CONFIG_HOME` if it's available, but if not it falls back to the defaults defined by the [xdg](https://github.com/adrg/xdg) package. Unfortunately the defaults the package falls back to isn't what CLI applications commonly fall back to on macOS. Specifically, it looks in `~/Library/Application Support` instead of `~/.config`. This updates the app config logic to: - Look for `~/.config/lazygit` first if `XDG_CONFIG_HOME` is not set and we're on macOS. - Fallback to the existing `xdg` package location if the configuration file exists there. - Default to `~/.config/lazygit/config.yml` if `XDG_CONFIG_HOME` is not set, we're on macOS, and there is no existing configuration file. This change did feel a bit like having to thread a needle and I didn't see any existing tests for this behavior (which is reasonable, since it's complicated and OS dependent) so I did test a few variations of the configuration locally by building with this change included and running a `brew` installed lazygit. It seemed to work properly, falling back to the existing location when `XDG_CONFIG_HOME` isn't set, using `~/.config/lazygit` when `config.yml` is present, and creating `~/.config/lazygit/config.yml` when it's not. I think this should resolve jesseduffield#1341
If both Linux and MacOSX supported the same directory for configuration it would make it easier to script machine setup. In fact some of the Rust based tools I use only support the
.config
directory, it'd be a rare developer who doesn't have that directory on their Mac.The text was updated successfully, but these errors were encountered: