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

add XDG_CONFIG_HOME for py3status, organize paths #1694

Merged
merged 11 commits into from
Mar 25, 2019
Merged

Conversation

lasers
Copy link
Contributor

@lasers lasers commented Feb 5, 2019

This add sensible xdg config paths for py3status. Ref: #1584 (comment)

@lasers lasers added this to the 4.0 milestone Feb 5, 2019
py3status/cli.py Outdated
@@ -63,6 +63,8 @@ def parse_cli():
# i3status config file default detection
# respect i3status' file detection order wrt issue #43
i3status_config_file_candidates = [
"{}/py3status/py3status.conf".format(xdg_home_path),
"{}/py3status/config".format(xdg_home_path),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think having one file ~/.config/py3status/config is enough, no need to introduce multiple alternatives - this one is similar to ~/.config/i3status/config, let's go with it.

Copy link
Contributor Author

@lasers lasers Feb 5, 2019

Choose a reason for hiding this comment

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

We have three i3status.conf and not one py3status.conf... and if users don't like ~/.config/py3status/config, they have an option to use py3status.conf... then -c.

What stands out... ~/.i3/i3status.conf, ~/.config/i3/i3status.conf, etc. They all are in "wrong" / convenience places... and it looks like /etc/xdg/i3status/config is nearly at end of the list instead of nearly at top of the list according to i3status man page. Is i3status man page wrong or out of date?

EDIT: We can't say py3status.conf if we don't support it. Put the name out there.

Copy link
Contributor

Choose a reason for hiding this comment

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

I cannot imagine why someone would not like ~/.config/py3status/config if that's a perfectly reasonable XDG compliant file name, my point was just that we already have a zoo of config locations and adding two more seems excessive, one is enough in my mind. But I don't have a strong opinion, so I approve the PR. Perhaps worth getting others' opinions before merging.

Copy link
Contributor Author

@lasers lasers Feb 5, 2019

Choose a reason for hiding this comment

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

I don't have a strong opinion too. I personally use ~/.config/py3status/bottom.conf... and if I really need more, I will turn on top.conf or test.conf.

Also, because it's easier to jump open v py3status.conf in shell than v py3 config... not working or opening wrong one... so you do v config py3st conf. Random examples.

Other than that, I think we should support ~/.config/py3status/py3status.conf because this PR would make it xdg friendly (EDIT: for py3status). At same time, we say we support py3status.conf now too. Idk.

@ultrabug
Copy link
Owner

If we are to add options for XDG, I'd like them to be at the end of the list please

@lasers
Copy link
Contributor Author

lasers commented Feb 10, 2019

I don't get this. Why do we not want py3status name on top of the list to be tested first?

  • ~/.config/py3status/py3status.conf <--- default py3status config (we never had one before)
  • ~/.config/py3status/config <--- honor XDG style to make people happy
  • test i3status and others next.... all the way to end /etc/i3status.conf.

@ultrabug
Copy link
Owner

Because py3status is an i3status wrapper so we first respect i3status' way of finding out its config, and then if we want to add ours, we can

@lasers
Copy link
Contributor Author

lasers commented Feb 10, 2019

If our py3status config comes first, shouldn't we use that instead though? py3status overrides i3status.

@maximbaz
Copy link
Contributor

* ~/.config/py3status/py3status.conf is honoring XDG style too I believe, so maybe we should ditch ~/.config/py3status/config?

@ultrabug
Copy link
Owner

I'm not even sure I like the idea tbh. Our philosophy says : no added configuration file and yet you are proposing to create py3status.conf

There is no need for that tbh

@maximbaz
Copy link
Contributor

My opinion is the following: if ~/.config/py3status/py3status.conf and ~/.config/py3status/modules/ were supported, I would definitely use them instead of the current ~/.config/i3/i3status.conf and ~/.config/i3/py3status/ paths, because when I want to edit py3status config, I think of py3status in my head, I don't really think that it's based on i3status and therefore I need to look for i3status config instead 🙂 At the same time, strictly speaking even ~/.config/i3/i3status.conf is XDG-compatible.

So, I'm fine with any choice that you make here 😉

@lasers
Copy link
Contributor Author

lasers commented Feb 10, 2019

Other thing is that if we support this, users don't have to do py3status -c ~/.config/py3status/py3status.conf -i ~/.config/py3status/modules in their i3 config. I admit I use this for long time. Sure on wrapper, but it is py3status I am using, not i3status or i3status.conf.

@thiagokokada
Copy link
Contributor

I also would like to have proper XDG_CONFIG_HOME paths. For all things that py3status add I can't simple take my py3status file and run it on i3status. The contrary is true, however the default paths as they current are make it impossible to have a different config file for py3status and i3status (unless of course passing -c switch to py3status, however this seems strange for what should be a common user case).

@lasers
Copy link
Contributor Author

lasers commented Feb 27, 2019

this pr

1) /home/user/.config/py3status/py3status.conf
2) /home/user/.i3status.conf
3) /home/user/.config/i3status/config
4) /home/user/.config/i3/i3status.conf
5) /home/user/.i3/i3status.conf
6) /etc/xdg/i3status/config
7) /etc/i3status.conf

what i think it should be.. after reviewing manuals, commits, etc.
i3status manpage is wrong in current release. is fixed in latest master.
orders changed more than twice in i3status and/or i3 too.

-) /home/user/.config/py3status/config  # py3 xdg path
3) /home/user/.config/i3status/config
4) /home/user/.config/i3/i3status.conf  # custom i3 xdg path
2) /home/user/.i3status.conf
5) /home/user/.i3/i3status.conf  # custom i3 traditional path
6) /etc/xdg/i3status/config
7) /etc/i3status.conf

this part custom. to say and support py3status.conf with confident too (?). this no 1 in list too.

1) /home/user/.config/py3status/py3status.conf  # custom py3 path

but we have (xdg) correct ~/.config/py3status/config so it might not be needed (and may be better to use symbolic links (py3status.conf -> config) to keep it clean. what say you?

@lasers
Copy link
Contributor Author

lasers commented Feb 28, 2019

@ultrabug Can you review this? I remove a duplicate. I find i3/i3status making mistakes over there... and they fixed paths over there too... so I want to organize/paths correctly. If users have a stray config and are detected, then yes, it will use that... only because it's a stray config.

Nothing is removed, but non-official paths would be tested after official paths... not before.

You can review/test paths this with:

diff --git a/py3status/argparsers.py b/py3status/argparsers.py
index 2f811f8..e323587 100644
--- a/py3status/argparsers.py
+++ b/py3status/argparsers.py
@@ -183,6 +183,15 @@ def parse_cli_args():
             "{}/.i3/py3status".format(home_path),
         ]
 
+    print('---i3status config paths--------')
+    for x in i3status_config_file_candidates:
+        print(x)
+    print("")
+    print('---module paths--------')
+    for x in options.include_paths:
+        print(x)
+    parser.exit()
+
     include_paths = []
     for path in options.include_paths:
         path = os.path.abspath(path)

@lasers lasers force-pushed the xdg-config-home branch from 566ba01 to 9cf03dd Compare March 4, 2019 22:22
@lasers lasers force-pushed the xdg-config-home branch 3 times, most recently from 650ce9c to 5174cbd Compare March 16, 2019 21:54
@lasers lasers changed the title add XDG_CONFIG_HOME paths for py3status argparsers: add XDG_CONFIG_HOME for py3status, organize paths Mar 16, 2019
@lasers lasers changed the title argparsers: add XDG_CONFIG_HOME for py3status, organize paths add XDG_CONFIG_HOME for py3status, organize paths Mar 16, 2019
@ultrabug
Copy link
Owner

OK guys I agree with you, thanks for taking the time to convince me :)

All I ask now is an updated documentation about this please

@lasers lasers requested a review from ultrabug March 24, 2019 19:06
@ultrabug
Copy link
Owner

I updated the docs

@ultrabug ultrabug merged commit 6d1523d into master Mar 25, 2019
@lasers lasers deleted the xdg-config-home branch March 25, 2019 08:45
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.

4 participants