simple pomodoro script

One of the coolest things about the XDG Base Directory Specification is that it gives control to the user to specify where all the various dotfiles and so forth go via environment variables (with sane defaults).

So I’d like to suggest something like this:

config_folder = os.environ.get('XDG_CONFIG_HOME', os.path.expanduser('~/.config'))
config_path = os.path.join(config_folder, 'beeminder/.pomrc')

This lets users override the location of their config folder by exporting the XDG_CONFIG_HOME environment variable. (It also slightly improves things by taking full advantage of os.path.expanduser's ability to expand the tilde at the beginning of a longer path, and not just when the tilde is on its own.)

3 Likes