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

config: Support config in $XDG_CONFIG_HOME #334

Merged
merged 2 commits into from
Feb 24, 2018

Conversation

kc9jud
Copy link
Contributor

@kc9jud kc9jud commented Nov 26, 2017

Resolves #328.

Copy link
Contributor

@emansije emansije left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but in the README.md file you should also add:

powerline-shell --generate-config > $XDG_CONFIG_HOME/powerline-shell/config.json

as an alternative way to generate the initial configuration file. There should also be a warning that if $XDG_CONFIG_HOME is not set, one should use the default:

powerline-shell --generate-config > ~/.config/powerline-shell/config.json

In fact, since many systems don't set that variable at all, the default should be added to the code that gets the value. I made a comment in the code.

Wouldn't it also be better to remove from the README.md the original path for the configuration file? That would make sure that the new one becomes the norm. I'd preserve the code in powerline_shell/__init__.py to find the configuration in older locations, of course.

What do you think?

@@ -134,6 +134,7 @@ def find_config():
for location in [
"powerline-shell.json",
"~/.powerline-shell.json",
os.path.join(os.environ.get("XDG_CONFIG_HOME", ""), "powerline-shell", "config.json"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it would be better to set a default:

os.path.join(os.environ.get("XDG_CONFIG_HOME", "~/.config"), "powerline-shell", "config.json"),

since many systems don't set the XDG_CONFIG_HOME environment variable.

@@ -151,7 +151,8 @@ alias precmd 'set prompt="`powerline-shell --shell tcsh $?`"'
### Config File

Powerline-shell is customizable through the use of a config file. This file is
expected to be located at `~/.powerline-shell.json`. You can generate the
expected to be located at `~/.powerline-shell.json` or
`$XDG_CONFIG_HOME/powerline-shell/config.json`. You can generate the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say that it would be better to delete the ~/.powerline-shell.json reference in order to promote the new location and escape from "the tyranny of the default".

@kc9jud
Copy link
Contributor Author

kc9jud commented Nov 28, 2017

I went ahead and changed the default in __init__.py

As for the documentation, I'm going to defer to @b-ryan...

@b-ryan
Copy link
Owner

b-ryan commented Feb 24, 2018

Sorry for the long delay on this. I thought about it fairly frequently and kept having mixed feelings. At this point I am onboard & will include this in the next release.

I will update the docs to encourage just the new config path.

@b-ryan b-ryan merged commit cf6a804 into b-ryan:master Feb 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants