How is the XDG base directory specification defined?

How is the XDG base directory specification defined?

The XDG Base Directory Specification is based on the following concepts: There is a single base directory relative to which user-specific data files should be written. This directory is defined by the environment variable $XDG_DATA_HOME . There is a single base directory relative to which user-specific configuration files should be written.

How is the XDG RUNTIME DIR path defined?

This directory is defined by the environment variable $XDG_RUNTIME_DIR . All paths set in these environment variables must be absolute. If an implementation encounters a relative path in any of these variables it should consider the path invalid and ignore it.

Where to find XDG data in a subdir?

Such file should be installed to $datadir /subdir/filename with $datadir defaulting to /usr/share. A user-specific version of the data file may be created in $XDG_DATA_HOME /subdir/filename, taking into account the default value for $XDG_DATA_HOME if $XDG_DATA_HOME is not set.

What should be stored in XDG _ state _ home?

The $XDG_STATE_HOME contains state data that should persist between (application) restarts, but that is not important or portable enough to the user that it should be stored in $XDG_DATA_HOME. It may contain: actions history (logs, history, recently used files, …)

What do I need to know about XDG RUNTIME DIR?

$XDG_RUNTIME_DIR defines the base directory relative to which user-specific non-essential runtime files and other file objects (such as sockets, named pipes,…) should be stored. The directory MUST be owned by the user, and he MUST be the only one having read and write access to it. Its Unix access mode MUST be 0700.

What should be the default XDG state home?

If $XDG_STATE_HOME is either not set or empty, a default equal to $HOME /.local/state should be used. The $XDG_STATE_HOME contains state data that should persist between (application) restarts, but that is not important or portable enough to the user that it should be stored in $XDG_DATA_HOME.