Skip to content

Move config directory (& state?) to XDG paths #144

Closed

Description

@paravoid

(Thanks for writing gmailctl and releasing it as open source!)

The proliferation of dot files/directories in users' home directories, the poor portability of paths like ".app" as well as the mixing of config and state are problems that are being addressed by the (now ubiquitous) freedesktop.org XDG base directory specification. This specifies directories like ~/.config/gmailctl (and possibly ~/.local/share/token.json) on Linux systems, and equivalent paths on OS X & Windows, unless overriden by environment variables. It'd be great if gmailctl moved its paths to match the XDG specification.

The implementation should be easy enough, but there are multiple Go libraries implementing this as well¹:

(All but the last are used enough to exist as a Debian package, if that matters)

1: There is a certain irony in a proliferation of libraries trying to address a proliferation problem…

Activity

  1. changed the title [-]Move config director (& state?) to XDG paths[/-] [+]Move config directory (& state?) to XDG paths[/+] on Sep 27, 2020
  2. mbrt commented on Sep 29, 2020

    @mbrt
    Owner

    I agree that this would be an improvement for new users.

    The problem is the migration path for existing installations. I would avoid moving their files around, as many use symlinks or rely on the config directory to not change. Perhaps the only safe way to do this would be to always check if $HOME/.gmailctl is empty, and if so use the new path.

  3. added
    lifecycle/keep-aliveDenotes an issues or PR that should never be considered stale.
    on Sep 29, 2020
  4. lgarron commented on Mar 21, 2024

    @lgarron
    Contributor

    Perhaps the only safe way to do this would be to always check if $HOME/.gmailctl is empty, and if so use the new path.

    I've submitted a PR for this: #393

    In theory it could be improved by using a library, but it's only a 4 additional lines of code to avoid the primary issue of requiring a folder directly in the home directory. Seeing as this issue has the most upvotes, I think it would be a welcome improvement over the existing behaviour!

  5. mbrt commented on Mar 23, 2024

    @mbrt
    Owner

    I'm inclined at this point to say that this is a nice to have but will probably not be implemented. The risk of breaking existing users, plus introducing a weird behavior by which in certain situations the old directory is considered and in others we get the standard behavior, for me are not worth the trouble.

    This can also be easily solved by the end user by simply aliasing gmailctl:

    alias gmailctl='gmailctl --config=$HOME/.config/gmailctl'
    

    I'll keep this open for now as I want to take another look in case there's an easy and clear to understand solution I'm missing.

  6. lgarron commented on Jun 17, 2026

    @lgarron
    Contributor

    This remains the most upvoted issue by over a factor of 2, so I think it's fair to say quite a few of us nerds who like to keep our email config clean also like to keep our home directory clean.

    I've rebased and updated #393 at #455

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureNew feature or requestlifecycle/keep-aliveDenotes an issues or PR that should never be considered stale.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions