Changer le chemin des dossiers utilisateur par défaut?


24

Dans les versions précédentes d'Ubuntu, j'utilisais Ubuntu Tweak pour modifier les chemins d'accès aux dossiers utilisateur (Musique, Documents, Vidéos, etc.).Je ne trouve pas d'option dans Gnome 3 pour faire cela, et le ppa d'Ubuntu Tweak n'a toujours pas de version pour Oneiric.

36

Open a terminal and write this command:

gedit ~/.config/user-dirs.dirs

Each row is a user folder definition (music, video...), edit as you want. For example, I did not want the videos folder in home, but in a separate disk, and changed the XDG_VIDEOS_DIR parameter this way:

XDG_VIDEOS_DIR="/media/share/Video"

OR simply run:

xdg-user-dirs-update --set XDG_VIDEOS_DIR "/media/share/Video"

Logout and login back to effect properly.


2

You can still install Ubuntu Tweak and do it with that, if you dont want to mess around with the terminal.


2

As at today (7 years later!), my experiments seem to show:

  1. These variables are set in the file ~/.config/user-dir.dirs relate to XDG, which stands for "X Desktop Group"... i.e. they appear to relate to the "windowing" processes. But for example, none of these variables are then accessible by the user (or root) as an environment variable

  2. It appears that the variable XDG_DOCUMENTS_DIR is the one which is responsible, in Nemo, for giving one particular directory a "special" icon

  3. That's what we're all bothered about: how to give one particular directory a special icon all to itself, signifying "this is your DOCUMENTS directory"

  4. To give this to a particular directory other than ~/Documents,
    -- a. make a link from the directory you want under "My Computer" in the LH panel of Nemo
    -- b. change the value of the XDG_DOCUMENTS_DIR variable in ~/.config/user-dir.dirs to this directory, using an absolute path.
    -- c. log out and back in: whatever its name may be, in both the LH and RH side of Nemo your directory should now have the "special" DOCUMENTS icon!

NB it is not sufficient, as suggested in a comment above, simply to delete the ~/Documents directory for everything to work OK. Bear in mind in particular that, if at startup it is found that the XDG_DOCUMENTS_DIR path actually doesn't lead to a valid directory, the setting for XDG_DOCUMENTS_DIR will be overwritten in user-dir.dirs, replacing it, in principle, with $HOME/Documents... (in fact, oddly, my experiments seem to find that it is usually replaced with $HOME, for some inexplicable reason).

NB2 as an alternative to the above (especially if the "special" icon doesn't matter in particular to you), you could use a symlink ... which you can call "Documents". In fact, you could have both: a symlink and a special icon for your target file.

NB3 I don't believe you can make a symlink as suggested ... AND give it a special DOCUMENTS icon! But given this, all seems to be about cosmetics anyway maybe it, um, doesn't matter much!