Extending Freedesktop Paths

Robert Crowther Jan 2022

How to change the configuration paths used by a Freedesktop operating system.

You would do this because at least one Freedesktop distribution I’ve encountered, Linux Mint, has no paths for userspace. And why should it, because then it needs to reconfigure for every change in users? Also, changes to the desktop are probably required systemwide. That said, from posts on the web, this flexibility has caused confusion.

Incidentally, in the specs, Freedesktop encourage users to modify the paths if necessary. So you are not potentially destroying your system. That said, this is rather grimy Linux configuration.

Check the current XDG paths

Run this,

printenv XDG_DATA_DIRS

On an older Linux Mint this is my return,

printenv XDG_DATA_DIRS
/usr/share/cinnamon:/usr/share/gnome:/home/XXXXX/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share

Humm. I only care about the one user. And I’d like changes out of the way, and to stay operative if Freedesktop is updated. But I have no local path listed. Well, there is one for ‘flatpak’. Flatpack is an interesting technolgy for automatic installs, so I don’t want to use that path. I think what I would like is,

~/.local/share

Alternatives to messing with paths

If your operating system has a similar freedesktop configuration, there are several ways to go. You could,

Use /usr/local/share

The path is configured. There’s an argument custom data should go there (it’s systemwide), and one that it should not (this is my tweak, not automation)

Use the flatpak path

The path is configured. But flatpak is for automation—I honestly don’t know enough about it

Configure a userspace path

Risks an upgrade loss. But believable placement

Ok, you still want to configure a userspace path.

Create a new userspace path

Create,

sudo nano /etc/profile.d/xdg_paths.sh

Add this. Note that ‘myHomePath’ must be absolute e.g. ‘/home/jenny/’. Don’t use shortcuts,

export XDG_DATA_DIRS="$XDG_DATA_DIRS:myHomePath.local/share"

Restart the computer. Or try,

source  /etc/profile.d/xdg_paths.sh

But I don’t think that works? I think you need to at least log off, then on.