nb icon indicating copy to clipboard operation
nb copied to clipboard

Use XDG_CONFIG_HOME if available

Open MrDowntempo opened this issue 9 months ago • 4 comments

Be warned. This is my first pull request EVAR. I'm not much of a coder, and I don't write my own bash scripts. I've tested this and it seeeems to work as a clean install, but I doubt it'll handle existing installs elegantly, if at all. Also this script is huuuge so I could've easily overlooked another place that needs an edit. If I've not gone about this the correct way, lemme know I'll try my best to do better next time.

This change should check if XDG_CONFIG_HOME exists, and if it does, create an nb subdirectoy in there for your .nbrc file (by way of the _ME variable)

I find having .nbrc in my home directory icky and want to tuck it away where it belongs. If this works, I'll try making XDG_STATE_HOME the default parent of the default notebook directory next.

This doesn't handle anything fancy like the preference-ordered XDG_CONFIG_DIRS variable.

MrDowntempo avatar May 05 '25 15:05 MrDowntempo

Great addition, I would also like something like this. Welcome to the world of GitHub submissions! It is a learning process for all of us, although be warned that some people forget that and get quite mean sometimes. I'm not a maintainer, but I'll leave a review momentarily to get more activity on this PR.

Since this is your first PR and you seem to be unsure on etiquette, I'll mention a few things that hopefully help! Just disregard if you already know this:

  • Regarding your posted issue (#379), it can take maintainers a while to get to a PR sometimes, if they are even still actively maintaining the repo. Afaik nb is still being actively maintained since there were PRs merged in the last few months, but this likely isn't their full time job so you'll probably just have to wait for them to get to it. Making extra issues to get their attention could annoy some maintainers. For future submissions, I've seen it be more effective to leave a comment on your PR pinging the maintainer(s) with an @ mention letting them know that your PR is ready for review. Making an issue describing the feature you want beforehand also helps!
  • I'd recommend doing a quick search through existing issues and PRs on the repo (both open and closed) to get up to speed on any related discussions or progress that has already happened. Mention these related items on your PR to help the maintainers out and link together common items. For example, from a quick search of "xdg", it is worth mentioning that your PR would at least partially satisfy #277. When possible, also use closing words to help automatically close an issue that your PR addresses fully, like "closes #379" (I'm not sure if this will work from a comment).

zachcran avatar Jun 11 '25 22:06 zachcran

Thanks for the pointers, and for reviewing/improving the code, @zachcran I really appreciate it! Hopefully @xwmx pops in too.

MrDowntempo avatar Jun 13 '25 14:06 MrDowntempo

Thanks for exploring this. I've thought about this a few times and haven't tackled it yet because it gets complicated. We should have thorough test coverage to make sure everything works. The $NB_DIR location also has to be considered. It seems like that would probably have to exist in $XDG_DATA_HOME which defaults to $HOME/.local/share.

xwmx avatar Jun 24 '25 17:06 xwmx

The $NB_DIR location also has to be considered. It seems like that would probably have to exist in $XDG_DATA_HOME which defaults to $HOME/.local/share.

Does $NB_DIR need to be considered for this PR, or are you saying "in general for full XDG compliance"? If the latter, we could move the discussion on that part to a separate issue. From my interpretation of the XDG spec, you are correct on the location; notes would fall under $XDG_DATA_HOME/nb (defaulting to $HOME/.local/share/nb). Currently, mine specifically live in $XDG_DATA_HOME/nb/notes to leave space for other data there.

zachcran avatar Jun 29 '25 01:06 zachcran