Score:0

How can I prevent folders in a user’s home directory from being displayed on his desktop?

in flag

After installing Xubuntu 22.04 on a laptop previously running with Xubuntu 18.04 (not altering its existing partition /home, I just designated its existing partition as /home during install), I had to repeat all configurations (panel, appearance of the desktop, configuration of Firefox, Shortcuts, automatically started applications…). I also had to create users and groups as they were before on the old system (I hope did it without creating new home directories for them).

In order to save all this configuration work for the second user, I just copied the hidden folder .config from the home directory of the first user, for whom I had established all these settings. Of course I adjusted owners and access rights to the user's home directory before proceeding.

This method worked well in other cases, only few fine tuning operations became necessary for the other user (like modifying the desktop backdrops appearance and other user-specific things).

But one thing is really strange and I don’t know how to cope with it:

All the basic folders from that user’s home directory are shown on the desktop as if they were part of that user’s directory ~/Arbeitsfläche (desktop)! Those directories are not shown as links but rather as if they are really situated in his personal folder desktop but they are not there, as Thunar shows. However, if I delete one of those directories to the trash can, it also is deleted from that user's home directory!

In a German localization, the folder desktop is sometimes called Arbeitsfläche, in some other cases it is called Schreibtisch. I have already placed question 1466339 what really defines the name of this folder.

I have no idea what causes this strange behavior, nor do I have any idea, how to prevent folders like Bilder, Dokumente, Downloads, Musik, Öffentlich, …, snap, Vorlagen being shown there, whereas the content of the folder Arbeitsfläche or Schreibtisch is not shown, but the folder itself is shown instead!

How can I fix this?

guiverc avatar
cn flag
You can *upgrade via re-install* and keep your existing user files, configs & setup (*providing they are set for each user and not global configs*) by just re-using (**without format**) the `/home` space... be it on separate partition or not. You appear to have not used that (*as other than being a newer Xfce, I'd expect the system to look identical after re-install*) or is this what you attempted. As system directories get erased; multiple users likely don't survive the install case I'm referring to (*QA for it only involves a single user install*) but I'd still expect user setups to exist..
in flag
I was unaware of *re-install*. I installed the system without formatting the previous `/home` partition, I just told the installation procedure to mount it as `/home`. Of course the old system folders did not survive the installation into the old system partition, since I formatted it during the installation (contrary from the other partitions). The strange thing is, that it looks as if the desktop-folder of the second user were mounted into his home directory, i.e. his basic folders all appear on the desktop and I fear I should not delete them there - or risk loss of data!
guiverc avatar
cn flag
If you don't format partition(s) including the / or *root* partition - a repair type of installation is triggered which just ~non-destructively re-installs the system. It takes note of your installed packages (those *manually-installed* or you added after installation), erases system directories (thus global configs won't survive; note server apps can store data in system directories; this install type is for desktop systems), then installs from media, if internet is available it'll download & re-install the noted *manually installed* packages., then ask you to reboot..
guiverc avatar
cn flag
This was intended for the same release; but no release check is performed allowing you to use it for upgrades (*though some upgrade issues can occur; eg. qt4 was removed in 2019, python2 etc. can cause issues in newer release package location; just ignore those*) but user configs survive (anything in user directory isn't touched.. only *system* directories were erased, thus any global configs will get lost). Xfce in 18.04 was still mostly GTK2, its GTK3t in 22.04 thus some changes did occur but sorry I like my desktop *clean* so aren't familiar with what changes occurred there
in flag
What can I do to right now? All folders are there, but they are all shown on the desktop where the user does not place and wherer things could easily be deleted by accident.
in flag
The folder for the desktop of the first user was called "Arbeitsfläche". The original (i.e. left over) name of this folder from the previous 18.04 installation was different, probably it was "Schreibtisch". I renamed it to "Arbeitsfläche" since this is the name of that thing got in the new installation. I remember that this renaming took quite some time to be finished. But after renaming, the folder is shown on the desktop rather than its content. What defines the real file name of the thing to be shown as desktop and the symbol for Thunar? (That's why I posted the other question above).
Nmath avatar
ng flag
A shortcut around this is to create a new user and then copy only what you actually need from the home folder you used on the previous installation. If you are keen to keep your username, you'll have to do some shuffling so you can delete/purge your current user from another administrator account and recreate it as a new user. Don't forget to add yourself to sudoers so you don't lock yourself out of being a user with sudo powers.
Score:0
in flag

The culprit is the file ~/.config/user-dirs.dirs. Its content is (when it is right):

# 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.
# 
XDG_DESKTOP_DIR="$HOME/Schreibtisch"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Vorlagen"
XDG_PUBLICSHARE_DIR="$HOME/Öffentlich"
XDG_DOCUMENTS_DIR="$HOME/"
XDG_MUSIC_DIR="$HOME/"
XDG_PICTURES_DIR="$HOME/Bilder"
XDG_VIDEOS_DIR="$HOME/"

The line about XDG_DESKTOP_DIR read

XDG_DESKTOP_DIR=“$HOME/”

As the prefix of the file says, all changes to it are retained at the next startup, but I have observed that they are rolled back. Has someone stumbled over a language hurdle? The comment first mentions xdg-user-dirs-update. Looking at the manpage of it, it updates the current state of the file user-dirs.dir. If none exists before calling it, then one is created based on the system default values, or falling back to the old non-translated filenames if such directories exists. The list of old directories used are: ~/Desktop, ~/Templates and ~/Public.

In my case the word Schreibtisch was missing in the line XDG_DESKTOP_DIR="$HOME/Schreibtisch". After deleting ~/.config/user-dirs.dirs, calling xdg-user-dirs-update created a new version of it with the corresponding line

XDG_DESKTOP_DIR="$HOME/Schreibtisch"

Before this sucessfull approach I had followed this suggestion: Log out, change this line and log in again. That did not work: The changes were gone because xdg-user-dirs-update is invoked early in the login process.

In order to reset the file to the default value, I first renamed ~/.config/user-dirs.dirs to user-dirs.dir.bak and then I invoked xdg-user-dirs-update. I checked for the name attributed to the desktop directory. In my case it had become Schreibtisch (which differs from Arbeitsfläche automatically given to the directory of the first configured user after installing Xubuntu 22.04). Therefore I reverted my renaming of the second unser's desktop folder back to Schreibtisch.

(After installation the German name for the desktop folder of the first user was Arbeitsfläche. In order to make it consistent with the installed system, I had renamed the existing desktop folder Schreibtsch of the second user to Arbeitsfläche. I was amazed, that it took longer than expected. After the repair on ~/.config/user-dirs.dirs where the folder name had become Schreibtisch, I had to revert my initial renaming of the folder.)

After renaming it consistent with what has been placed into user-dirs.dir, logging out and in again, the newly created file user-dirs.dir became effective. The content of the previous folder Schreibtisch was shown as desktop and the standard folders of the second user had vanished from his desktop. I deleted user-dirs.dir.bak and I was happy with the result.

My approach cloning ~/.config from a well configured user to another one is not advisable. I searched ~/.config for files containing the string /home/<first user> and replaced them with /home/<second user>. There were a few files where such a change was necessary.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.