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

[Feature]: move settings under $HOME/.config/waveterm #1025

Open
maxadamo opened this issue Oct 12, 2024 · 8 comments · Fixed by #1047
Open

[Feature]: move settings under $HOME/.config/waveterm #1025

maxadamo opened this issue Oct 12, 2024 · 8 comments · Fixed by #1047
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@maxadamo
Copy link

Feature description

settings are currently stored under $HOME/.waveterm, and as a result of this the home directory is very cluttered.

Implementation Suggestion

The new applications tend to store the settings under $HOME/.config/<app-name>

Anything else?

No response

@maxadamo maxadamo added enhancement New feature or request triage Needs triage labels Oct 12, 2024
@esimkowitz esimkowitz removed the triage Needs triage label Oct 13, 2024
@esimkowitz
Copy link
Member

The location can be updated by manually moving the directory and setting the WAVETERM_HOME env var to the new location. Does this satisfy your use case? I'm hesitant to change the default right now as it might make the folder harder to find. Open to being convinced otherwise

@abhabongse
Copy link

abhabongse commented Oct 16, 2024

I would like to chip in a bit. Most modern applications in *nix (Linux, MacOS, etc.) respect XDG Base Directory Specification, which means that:

  • User configurations should normally be stored in $HOME/.config/waveterm/*
  • Other data (not intended to be user-configurable) should be stored in $HOME/.local/share/waveterm/*

Using $HOME/.waveterm is a somewhat surprising behavior for modern users of *nix, which may go against the point that "it might make the folder harder to find," depending on each user's diversed background experience.

Personally, I'm redefining $WAVETERM_HOME for now, and it's not a big deal at all. But moving towards a common convention would also be nice.

Sorry if I'm coming out as rude or too demanding.

Edit: One nice thing about using common $HOME/.config is that backing up config files for multiple applications are much simpler.

@esimkowitz
Copy link
Member

Y'all got me convinced 😄

Working to get this merged in v0.9, working out a back-compat story

@esimkowitz esimkowitz self-assigned this Oct 17, 2024
@maxadamo
Copy link
Author

Lots of changes have been implemented over time.
Back in the days, the root directory (/) was the home directory for root user, and it was cluttered (and everyone could list the files on /), /bin became a symlink, and I guess it will vanish at some point, sticky bits on files have been removed as well... so, yeah: let's ask to change WAVETERM_HOME to those who prefer using the $HOME/.waveterm directory 😸

Thanks.

@esimkowitz
Copy link
Member

yeah definitely leaving it there for folks who prefer it, but the new default will be XDG

@esimkowitz
Copy link
Member

@maxadamo @abhabongse I'm a bit hesitant to set .config as the default for macOS, given it's not the platform default (~/Library/Application Support). Do you have XDG_CONFIG_HOME, etc. manually set on macOS?

@esimkowitz
Copy link
Member

esimkowitz commented Oct 18, 2024

I've updated the PR with what I feel is a good compromise.

Going forward for new installations, config and data files will be stored at the platform default paths, as defined by env-paths.

For backwards compatibility, if the ~/.waveterm or WAVETERM_HOME directory exists and contains valid data, it will be used. If this check fails, then WAVETERM_DATA_HOME and WAVETERM_CONFIG_HOME will be used. If these are not defined, then XDG_DATA_HOME and XDG_CONFIG_HOME will be used. Finally, if none of these are defined, the env-paths defaults will be used.

As with the existing app, dev instances will write to waveterm-dev directories, while all others will write to waveterm.

@esimkowitz esimkowitz added this to the v0.9.0 milestone Oct 18, 2024
@maxadamo
Copy link
Author

I've updated the PR with what I feel is a good compromise.

Going forward for new installations, config and data files will be stored at the platform default paths, as defined by env-paths.

For backwards compatibility, if the ~/.waveterm or WAVETERM_HOME directory exists and contains valid data, it will be used. If this check fails, then WAVETERM_DATA_HOME and WAVETERM_CONFIG_HOME will be used. If these are not defined, then XDG_DATA_HOME and XDG_CONFIG_HOME will be used. Finally, if none of these are defined, the env-paths defaults will be used.

I don't have the XDG variables on my Mac. The solution that you are implementing looks good to me.
Some application installed with brew, store their configurations under $HOME/.config, some others don't. Maybe I should raise an issue for those applications, which are not adhering to the new standard.
For instance, even in Linux, Google Chrome respects the XDG standard but Firefox doesn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants