How to obtain the path of Desktop in gnome
One more way to do it:
dir=$(xdg-user-dir DESKTOP)
The locations of the user directories are described in the xdg-user-dirs specification. They provide some code here that you can copy, to look up the name of the desktop directory from within your code.
echo ${XDG_DESKTOP_DIR:-$HOME/Desktop}
works fine on a local linux drive and also when the /home/<user>
is mapped to an nfs drive.