sparrow icon indicating copy to clipboard operation
sparrow copied to clipboard

Support XDG Base Directory Specification on Linux

Open parrot7483 opened this issue 1 month ago • 4 comments

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.

parrot7483 avatar Dec 04 '25 12:12 parrot7483

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.

craigraw avatar Dec 11 '25 09:12 craigraw

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 .sparrow directory for all users (new and existing)
  • Fallback logic: If XDG paths contain Sparrow files, use those; otherwise, use the .sparrow directory

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?

parrot7483 avatar Dec 11 '25 12:12 parrot7483

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.

craigraw avatar Dec 12 '25 06:12 craigraw

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

parrot7483 avatar Dec 13 '25 22:12 parrot7483