Extending xdg-user-dirs

Cosimo Cecchi cosimo.cecchi at gmail.com
Wed Jan 15 11:00:41 PST 2014

Hi all,

I'd like to propose an extension to the current xdg-user-dirs mechanism to
make it possible to create application-specific subdirectories in user
dirs, which are subject to the same translation rules applied to their

Use cases:
* An application (e.g. a sound recorder) wants to save a file in a
subdirectory of $XDG_MUSIC_DIR. Another sound recorder wants to save files
in the same subdirectory, and doesn't want to worry about the translations
for each language to be in sync.

* A photo booth application wants to save pictures to a webcam snaps
subdirectory of $XDG_PICTURES_DIR. An "user properties" settings panel in
the desktop environment allows to pick an avatar picture through a file
chooser, which should default to the webcam snaps place.

There's a bunch of similar cases, which you can find in this bug [1] where
this message originates from.

We need a way for applications to describe and own those subdirectories
inside XDG user dirs. I think this could be as simple as the application
dropping a desktop file on installation, in a well-known directory - for
example $XDG_DATA_DIRS/xdg-user-dirs. Such a desktop file would have a
structure like

Name=Webcam Snapshots
Name[it]=Scatti dalla Webcam
Icon=icon-name-from-theme (optional)

An utility like xdg-user-dirs-update would then take care of renaming such
directories early at login, together with their parents. Toolkit support
would be achieved with a function that returns the full path of a
subdirectory given the basename of its desktop file descriptor.

In the example above, if the file is called "gnome-webcam.desktop", a GNOME
application would call g_get_user_special_dir_for_id
("gnome-webcam.desktop"); which would return "$HOME/Pictures/Webcam
Snapshots" in English and "$HOME/Immagini/Scatti dalla Webcam" in Italian.

[1] https://bugzilla.gnome.org/show_bug.cgi?id=712245

Feedback welcome!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/xdg/attachments/20140115/9fa65349/attachment.html>

More information about the xdg mailing list