The default path for the desktop directory varies between different languages.
Hence a better guess than $HOME/Desktop could be fetchedobtained from xdg-user-dirsdir in case that exists inon your system:
$ xdg-user-dirsdir DESKTOP
/home/arnie97/桌面
(Note that the package name is xdg-user-dirs, while the executable name is xdg-user-dir. Thank @theDrake for pointing this out.)
There's also another way fromdescribed on the xdg-user-dirs home page, which unfortunately does not work on my system:
Here is a shellscript example of how to find the desktop and the download directory:
test -f ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs && source ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs echo ${XDG_DESKTOP_DIR:-$HOME/Desktop} echo ${XDG_DOWNLOAD_DIR:-$HOME}For application code the hope is that the various desktops will integrate this and have a nice API to find these directories.