I am using gnome/Ubuntu-10.10 in Chinese language and the desktop path is not "~/Desktop" but "~/XXXX" where XXXX stands for the Chinese translation of "Desktop". So, how to write code to obtain the proper path of desktop regardless of the system language? I noticed Qt SDK properly added a shortcut on the desktop so I guess there is a way. Thanks a lot!
desktop files, which are located in /usr/share/applications (or sometimes /usr/local/share/applications ). Some applications may place these files in ~/. local/share/applications instead.
To navigate into the root directory, use "cd /" To navigate to your home directory, use "cd" or "cd ~" To navigate up one directory level, use "cd .." To navigate to the previous directory (or back), use "cd -"
Application menu, located beside the Activities button, shows the name of the active application alongside with its icon and provides quick access to windows and details of the application, as well as a quit item.
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.
If you are using Glib, you can do
const char *desktop_dir = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
This properly pays attention to the XDG environment variables and all that.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With