Module xdg

XDG Base Directory Specification paths

This module provides access to the directories defined by the XDG Base Directory specification. With this module, Lua scripts can determine the best place to store and look for various types of data.

The full XDG Base Directory specification is available here.

Usage notes

  • None of the returned directory paths end with a /.
  • The cache_dir, config_dir, and data_dir directories are the system cache, config, and user data directories respectively. Each of these directories contains a luakit sub-directory. Lua modules should use the luakit sub-directories to store and read data.

Properties

xdg.cache_dir

Type: string
Read-only
Get the base directory in which Luakit stores non-essential cached data. Data stored in this location may be removed in order to free up disk space. The returned directory is the XDG cache directory, not the luakit sub-directory within it that Luakit uses.

Example value: /home/user/.cache

xdg.config_dir

Type: string
Read-only
Get the base directory in which Luakit's configuration is stored. The returned directory is the XDG config directory, not the luakit sub-directory within it that Luakit uses.

Example value: /home/user/.config

xdg.data_dir

Type: string
Read-only
Get the base directory in which application/module data is stored. The returned directory is the XDG user data directory, not the luakit sub-directory within it that Luakit uses.

Example value: /home/user/.local/share

xdg.desktop_dir

Type: string
Read-only
Get the full path to the user's desktop directory.

Example value: /home/user/Desktop

xdg.documents_dir

Type: string
Read-only
Get the full path to the user's documents directory.

Example value: /home/user/Documents

xdg.download_dir

Type: string
Read-only
Get the full path to the user's download directory.

Example value: /home/user/Downloads

xdg.music_dir

Type: string
Read-only
Get the full path to the user's music directory.

Example value: /home/user/Music

xdg.pictures_dir

Type: string
Read-only
Get the full path to the user's pictures directory.

Example value: /home/user/Pictures

xdg.public_share_dir

Type: string
Read-only
Get the full path to the user's shared directory.

Example value: /home/user/Public

xdg.templates_dir

Type: string
Read-only
Get the full path to the user's templates directory.

Example value: /home/user/.templates

xdg.videos_dir

Type: string
Read-only
Get the full path to the user's videos directory.

Example value: /home/user/Videos

xdg.system_data_dirs

Type: {string}
Read-only
Get an array of paths where system data should be loaded from.

xdg.system_config_dirs

Type: {string}
Read-only
Get an array of paths where system configuration should be loaded from.

Attribution

Copyright