Difference between revisions of "XDG user directories"

From ArchWiki
Jump to: navigation, search
(typo, lk)
Line 1: Line 1:
 
[[Category:Desktop environments]]
 
[[Category:Desktop environments]]
{{i18n|xdg-user-dirs-update}}
 
 
 
'''xdg-user-dirs-update''' is a desktop-independent tool for configuring the location of certain user directories. Many applications of various [[Desktop Environment|desktop environments]] use the directories specified by xdg-user-dirs-update internally.
 
'''xdg-user-dirs-update''' is a desktop-independent tool for configuring the location of certain user directories. Many applications of various [[Desktop Environment|desktop environments]] use the directories specified by xdg-user-dirs-update internally.
  

Revision as of 16:25, 13 June 2012

xdg-user-dirs-update is a desktop-independent tool for configuring the location of certain user directories. Many applications of various desktop environments use the directories specified by xdg-user-dirs-update internally.

Installation

xdg-user-dirs-update is part of the xdg-user-dirs package available in [extra].

Configuration

The config file

xdg-user-dirs uses a configuration file located at ~/.config/user-dirs.dir. Its format is as follows:

 XDG_DIRNAME_DIR="$HOME/Dirname"

A complete file might contain multiple entries:

 XDG_DESKTOP_DIR="$HOME/Desktop"
 XDG_DOWNLOAD_DIR="$HOME/Downloads"
 XDG_TEMPLATES_DIR="$HOME/Templates"
 XDG_PUBLICSHARE_DIR="$HOME/Public"
 XDG_DOCUMENTS_DIR="$HOME/Documents"
 XDG_MUSIC_DIR="$HOME/Music"
 XDG_PICTURES_DIR="$HOME/Pictures"
 XDG_VIDEOS_DIR="$HOME/Videos"

xdg-user-dirs-update

The contents of the configuration file can be modified directly with a call to xdg-user-dirs-update. As an example, xdg-user-dirs-update --set TEMPLATES ~/.templates will set the template directory to the specified directory with respect to the current user's $HOME:

 XDG_TEMPLATES_DIR="$HOME/.templates"

xdg-user-dir

Once set, any user directory can be viewed with xdg-user-dir. For example:

$ xdg-user-dir TEMPLATES

will show the template directory, which of course corresponds to the XDG_TEMPLATES_DIR variable in the config file.

Applications using user directories

User directories are used internally by many applications: For instance, the template directory is used by Nautilus and Thunar to determine where to look for files to be passed to the Create Document context menu, whereas the desktop directory is used by Xfdesktop to find .desktop files to be shown on the Desktop.

External Resource