Automatically copy .desktop file to .local/share/applications

INFO:

OS="Debian GNU/Linux 10 (buster)"
DEBIAN PACKAGE=snapd/stable,now 2.37.4-1+b1 amd64 [installed]
SNAP CORE VERSION=installed:          16-2.46.1                              (9993)
APT REPOSITORIES:
deb http://ftp.br.debian.org/debian/ buster-backports main contrib non-free
deb-src http://ftp.br.debian.org/debian/ buster-backports main contrib non-free
deb http://ftp.br.debian.org/debian/ buster main contrib non-free
deb-src http://ftp.br.debian.org/debian/ buster main contrib non-free
fpc-deb@deb-msi:~$ echo "$XDG_DATA_DIRS"
/usr/share/gnome:/usr/local/share/:/usr/share/

I’ve had similar problems, but already tried restarting and setting $XDG_DATA_DIRS to the described directory in some options:

/etc/profile
/etc/enviroment
/etc/X11/Xsession -> Broke XORG, still trying

XDG_DATA_DIRS:$XDG_DATA_DIRS:/var/lib/snapd/desktop

WORKAROUND: fpc-deb@deb-msi ~ $ sudo ag "XDG_DATA_DIRS=" / 2>/dev/null | grep -v snap Which showed to me:

/etc/X11/Xsession.d/55cinnamon-session_gnomerc:17:      XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/
/etc/X11/Xsession.d/55cinnamon-session_gnomerc:19:      XDG_DATA_DIRS=/usr/share/gnome:"$XDG_DATA_DIRS"

but not necessarily will be the same for other people.

So my </etc/X11/Xsession.d/55cinnamon-session_gnomerc> final result was:

if [ -z "$XDG_DATA_DIRS" ]; then
      XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/
    else
      XDG_DATA_DIRS=/usr/share/gnome:"$XDG_DATA_DIRS"
    fi
    XDG_DATA_DIRS="$XDG_DATA_DIRS":/var/lib/snapd/desktop

OBS: I’m posting this, since this was the only hint i found on solving this problem. I’m guessing snap should have created a file on /etc/X11/Xsession.d/? OBS2: I tried reinstalling sudo apt reinstall snapd, which didn’t work.

Result:

fpc-deb@deb-msi ~ $ echo "$XDG_DATA_DIRS"                      
/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop

So, “SOLVED” :smiley: