Support XDG Base Directory Specification on Linux
Currently, Sparrow Wallet creates a .sparrow directory directly inside the user's home directory on Linux. This directory contains databases, configuration, logs, and other files.
Please update Sparrow Wallet to follow the XDG Base Directory Specification for storing configuration, data, and cache files. This would better integrate with Linux systems and allow users to manage their files more cleanly and in line with Linux standards.
While I am sympathetic to the desire to clean up a home directory, there is a significant downside to this. Currently, it's possible to copy the .sparrow directory to another computer on any supported OS and the config and wallets will be transferred. This makes backup simple as well. Splitting things up will make this much more difficult, and will probably be a worse UX for most. Given the cross-platform nature of Sparrow I think it's probably best to stick with the current approach. I'll also note that Bitcoin Core has not adopted the XDG specification.
Keeping the default behavior of using .sparrow makes sense. However, adding support for the XDG Base Directory Specification on Linux would be valuable for advanced users who prefer to follow Linux conventions. If I would not keep track of things, I would have dozens of directories in $HOME and different machines drifting.
A practical approach could be (this is how many apps do it):
- Default behavior: Continue using the
.sparrowdirectory for all users (new and existing) - Fallback logic: If XDG paths contain Sparrow files, use those; otherwise, use the
.sparrowdirectory
This way, users who want to manually organize their files according to the XDG specification can do so, while maintaining the standard .sparrow way for everyone else. Two or three sentences of documentation (here) should be enough as it's only for advanced users anyway.
What do you think?
That seems reasonable. As I understand it, it would require manual intervention to create the appropriate directories (and optionally copy existing files into them) for Sparrow to use XDG.
Yes. As long as it is documented it is fine.
Additionally, I could add the instructions to the arch wiki XDG page as well as xdg-ninja