RasmusLindroth / tut

TUI for Mastodon with vim inspired keys
https://tut.anv.nu
MIT License
449 stars 29 forks source link

config directory on macOs #170

Closed sophiabrandt closed 1 year ago

sophiabrandt commented 1 year ago

Actual Behavior:

On macOS, the config directory is /Users/<username>/Library/Application Support/tut.

Even if I create ~/.config/tut manually, the application uses the default config directory. Everything in ~/.config/tut is ignored.

Expected/Desired Behavior:

tut creates the folder ~/.config/tut (/Users/<username>/.config/tut) on macOs instead of default folder.

Alternatively, tut checks if ~/.config/tut exists and honors user configuration settings in that folder. It uses default macOs config folder as a backup.


Thank you for the application. ⭐

RasmusLindroth commented 1 year ago

I don't use MacOS, but is ~/.config the standard there?

Because tut uses golangs os.UserConfigDir() which defaults to $HOME/Library/Application Support on MacOS. Isn't it the default place to put configuration files for the user?

Or does programs on MacOS use it like /etc on Linux where the user can override the default config with ~/.config?

sophiabrandt commented 1 year ago

That's a good question. Yes, I think $HOME/Library/Application Support is standard.

However, AFAIK it is very common to be able to override it with $HOME/.config/<application name> or other more "Unix-y" directories, e.g. $HOME/.local.

I personally prefer those locations because I can better source control my configs as dotfiles.

Perhaps this is a good solution? https://github.com/sharkdp/bat#configuration-file

Set an environment variable to point to an alternative location for the config file.

RasmusLindroth commented 1 year ago

You can now use two new flags, --config and --config-dir if you want to load your configuration from a custom location. You can also use the environment variables TUT_CONF and TUT_CONF_DIR instead.

Thank you for the issue :)

bluedogtwo commented 1 year ago

Noticed that tut uses $HOME/Library/Application Support for config on macOS. Apps like broot, chezmoi, gcloud and nnn all use $HOME/.config/ without having to fuss around with configuring paths. That is the best place for config.