How does the GUI display a new file or directory

Linux :Ubuntu 21.0.4
When a file or directory was create on this path(/home/{user}/Desktop), how does the GNOME GUI know there is such a file or directory and display it on the desktop. inotify?

To watch files for change we have - Gio.FileMonitor
This is for developers making apps.

As a user, there are things like inotify

How do GNOME GUI know that?

If you mean by “GNOME GUI” the Gnome Desktop, as in “displaying icons on the desktop”, then the situation is that Gnome does not support desktop icons (and IMO it’s a good decision). If you want to display desktop icons nonetheless, then I would recommend you take a look at Desktop Icons NG.

I mean that when I use the shell to create a folder in this path (/home/{user}/Desktop, Gnome Desktop immediately displays the fold on the desktop. How does this work

To be honest, I am not quite sure what the question is, so I provide answers for both possibilities I can interpret your question.

  1. You have created a folder for the desktop and it’s not showing.
    In this case, see the comment before.

  2. You have created a folder and it is being shown on the desktop, but you want to understand how it functions.
    In this case, you’re having an extension which provides the desktop icons, most likely Desktop Icons NG, but you could check that with the Extensions App.
    Desktop Icons NG works as an extension launching the desktop icons in an Gtk Application, which in turn likely is using Gio.FileMonitor, but you can check the source code for that.

my question is the second. but I met a problem that it is the first when mount ovelayfs to the path /home/{user}/Destktop, it does not work.
the Repetition steps are below:

  1. cd / && mkdir lower upper work

  2. mount -t overlay overlay -o lowerdir=./lower,upperdir=./upper,workdir=./work /home/{user}/Desktop

  3. touch text.txt
    but it is not showing on the desktop

  4. init 3 && init 5.
    Howerver, when I switch mode from 3 to 5, Gnome desktop work well.

Guess this is then a issue with the extension, so my recommendation would be to report it at theirs repository.

First check which extension is responsible for your desktop, you could use the Extensions App or gnome-extensions list. Should the command give you as the used extension, you can use my already mentioned link to it’s source code and report it there.

Command gnome-extensions list shows nothing

Well, that is a problem where I don’t know an answer to… It should display your installed extensions.

Could it have to do with your overlay command? Could it be that you are overlaying your home-directory? That would be the only thing which I could still think about, otherwise I am out of ideas.

when I use command gnome-extensions list, I do not mount overlayfs
/home# df -h
Filesystem Size Used Avail Use% Mounted on
tmpfs 390M 1.9M 388M 1% /run
/dev/sda3 39G 9.4G 28G 26% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 4.0M 0 4.0M 0% /sys/fs/cgroup
/dev/sda2 512M 5.3M 507M 2% /boot/efi
tmpfs 390M 108K 390M 1% /run/user/1000
/dev/sr0 2.7G 2.7G 0 100% /media/wu/Ubuntu 21.04 amd64

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.