Americas

  • United States
sandra_henrystocker
Unix Dweeb

Taking control of your Ubuntu desktop

How-To
Apr 14, 20213 mins
Linux

Ubuntu gives you control of what files show up on your desktop – even if they're not in your Desktop folder.

ubuntu logo on network background
Credit: Thinkstock/Ubuntu

You may have a lot more control over your Ubuntu desktop than you know. In this post, we’ll look into what you should expect to see by default and how you can change that.

Most Linux desktops start out charmingly uncluttered. They display a handful of icons on an attractive background. These include shortcuts for launching applications, generally along the left side or bottom of the screen, and maybe another icon or two in the otherwise open area.

The uncluttered desktop is generally a good thing. You can open folders using your file manager and move around to any group of files that you need to use or update. By changing a setting on Ubuntu (and related distributions), however, you can also set up your system to open with a specified set of files in view – and you don’t have to move them into your Desktop folder to do so.

To most easily see how this setup is configured, open a terminal window and cd into a directory named .config.

shs@firefly:~/.config$ ls
dconf                     goa-1.0    libreoffice  session
eog                       gtk-3.0    nautilus     update-notifier
evolution                 htop       neofetch     user-dirs.dirs   
gnome-initial-setup-done  ibus       obs-studio   user-dirs.locale
gnome-session             komparerc  pulse        yelp

The user-dirs.dirs file is going to look something like this:

# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run.
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
#
XDG_DESKTOP_DIR="$HOME/Desktop"           
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"

The first setting in that file, XDG_DESKTOP_DIR, determines what files are displayed in the open area on your desktop. By default, this will be the contents of your Desktop folder (i.e., ~/Desktop). You can change this setting if you want to view your home directory or the contents of some other directory on your system – maybe files related to some project that you are focusing on.

You should first save the original file with a command like:

$ cp user-dirs.dirs user-dirs.dirs.SAVE

After all, you will probably at some point want to go back to the uncluttered look, and this will make it easy.

Once you’ve replaced “$HOME/Desktop” with “$HOME”, “$HOME/projects/db1” or even “$HOME/empty”, your next screen refresh or login should display the files from the selected location. The effect won’t be all that different from opening your file manager to the desired location, but might leave you reliably staring at just the right set of files. Whether you need to focus on a particular directory or escape the clutter of your normal desktop, it’s easy to do and easy to reverse.

Other settings

You’ve undoubtedly noticed that there are other settings in the user-dirs.dirs file as well. Some of these settings are likely used by various applications.

My older Ubuntu had the same file, but all the settings resolved to “$HOME”, not to subdirectories from my home directory. My current Ubuntu system is using release 21.02 (Hirsute Hippo).

sandra_henrystocker
Unix Dweeb

Sandra Henry-Stocker has been administering Unix systems for more than 30 years. She describes herself as "USL" (Unix as a second language) but remembers enough English to write books and buy groceries. She lives in the mountains in Virginia where, when not working with or writing about Unix, she's chasing the bears away from her bird feeders.

The opinions expressed in this blog are those of Sandra Henry-Stocker and do not necessarily represent those of IDG Communications, Inc., its parent, subsidiary or affiliated companies.

More from this author