0

I am using Ubuntu 22.04. After one update, the file ~/.config/user-dirs.dirs has changed the lines

XDG_DESKTOP_DIR="$HOME/" 
XDG_PUBLICSHARE_DIR="$HOME/"

So the folder Desktop and Public are missing and the Home folder shows on the Desktop. I have manually changed to

XDG_DESKTOP_DIR="$HOME/Desktop" 
XDG_PUBLICSHARE_DIR="$HOME/Public"

after recreating new folders Desktop and Public, logged out and the problem looked solved. But after restart, the system has re-written the user-dirs.dirs file as it was before and the problem is there again.

Is there a way to fix the changes to this file?

Thank you

guiverc
  • 30,396
Gigiux
  • 777

2 Answers2

0

How to prevent the rewriting of ~/.config/user-dirs.dirs

The following works for me on Ubuntu 22:

  • First change the system defaults
  • Then change the config
  • finally update

sudo nano /etc/xdg/user-dirs.defualts

nano ~/.config/user-dirs.dirs

xdg-user-dirs-update

-1

When the file .config/user-dirs.dirs changes after logon, there seems that xdg-users-dirs-update is being run (from .profile?, or from .bashrc?)

More info see the first 6 lines of .config/user-dirs.dirs:

# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run.
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
#

more info: man xdg-user-dirs-update

Luuk
  • 276
  • 2
  • 9
  • Sorry, but I still don't understand how I have to change this file... – Gigiux Sep 22 '23 at 08:17
  • I tried to writ-protect the file by changing its ownership just to the main user (the idea being one needed SUDO to change it) but it did not work, the file is rewritten at each startup – Gigiux Oct 18 '23 at 06:16
  • You are saying that this is not correct: "All local changes will be retained on the next run" (in the head of that file)? If so you should file a bug at the appropriate place. – Luuk Oct 18 '23 at 06:24