# Tails - Persistent Desktop Background

John Simpson `<jms1@jms1.net>` 2019-07-28

Last updated: 2019-08-14

This procedure will make Tails "remember" your desired background settings when you boot using a Persistent volume.

# Background

**Note:** I normally start these kinds of documents with a "Background" section, which provides background information about whatever the document is talking about. I'm pointing this out to be sure the reader doesn't think I'm specifically talking about the desktop background, since that *is* what this procedure will be "persisting".

The Tails "All Settings" GUI widget allows you to customize several parts of the system, including the desktop background. Tails comes with a small set of stock Debian wallpapers, and allows you to choose from a small number of fixed colors rather than using a picture.

However, there are a few issues with this:

* The settings you choose are not "persistent", i.e. when you shut down Tails and start it up again later, it doesn't "remember" your chosen settings.

* The set of fixed colors is limited to just the ones they included in the GUI widget. I normally prefer dark colors, like a grey, brown, or dark green, but none of those are included on their list.

One way to make it remember your chosen settings is to "persist" the `~/.config/dconf/user` file. However, this also "remembers" a lot more than just your desktop background, and some of those things you may not *want* it to remember, either for security reasons, or because you may run the same Tails USB stick on multiple machines with different hardware.

Another approach, which I found documented on the [Tails bug tracker](https://redmine.tails.boum.org/code/issues/8846), is to "persist" the `~/.xsessionrc` file. This file contains instructions which are executed when X (the graphical interface framework) starts a new desktop session. By persisting and customizing this file, we are able to make certain changes automatically when Tails boots using that persistent volume.


# Procedure

## Set up Persistence

* Applications -> Tails -> Configure Persistent Volume

* Make sure "Dotfiles" is enabled.

* You will probably want to enable the "Personal Data" option as well. This document assumes you have done so.

* Go down the list and make sure any other options you may want/need are enabled. I normally enable all of them.

If you just set up the persistent volume, or if you made any other changes, you should reboot before continuing.

## Make `.xsessionrc` persistent

This will do two things:

* Move the `~/.xsessionrc`file into the directry where the Persistence mechanism will find it, so that when Tails boots with this persistent volume active, the file will be symlinked into the `amnesia` user's home directory.

* Creates the same symlink that the Persistence mechaism will create, so you won't have to reboot right away.

Open a Terminal window and enter the following commands. (Obiously read through them and make sure you understand them first.)

```
cd
mv ~/.xsessionrc /lib/live/mount/persistence/TailsData_unlocked/dotfiles/
ln -s /lib/live/mount/persistence/TailsData_unlocked/dotfiles/.xsessionrc .
```

## Configure the desktop

Now that the `~/.xsessionrc` file is persistent, we just need to figure out the right commands to add to it.

### Background is an image

**If your desired background is an image**, you should store the image file within the persistent storage area. The simplest way to do this (assuming the "Personal Data" persistence option is enabled) is to store it under the `~/Persistent/` directory.

Running this command should immediately change the background to your desired picture:

```
gsettings set org.gnome.desktop.background picture-uri 'file:///home/amnesia/Persistent/1921_nantucketsunset_1920x1080.jpg'
```

Assuming it works, and you like how the desktop looks with it, edit the `~/.xsessionrc` file and add this command at the end.

To make Tails "remember" your desired color, add the following command to the end of the `~/.xsessionrc` file.

```
$ cat .xsessionrc
. /etc/amnesia/environment
export TAILS_WIKI_SUPPORTED_LANGUAGES

gsettings set org.gnome.desktop.background picture-uri 'file:///home/amnesia/Persistent/1921_nantucketsunset_1920x1080.jpg'
```

### Background is a solid color

**If your background is a solid color**, the process is similar but there is an extra step involved.

By default, Tails uses "`/usr/share/tails/desktop_wallpaper.png`" as its desktop image. This image is just a solid blue color, so I'm not sure why they didn't use a solid color to begin with, but whatever...

In order to use a *real* solid color as the background, we first need to make it *not* use this image.

```
gsettings set org.gnome.desktop.background picture-uri none
```

You probably won't see any change at this point, because the default `primary-color` value is the same as the color in this picture. However, after doing this, you will be able to set the desired background color, using a standard hex color code.

```
gsettings set org.gnome.desktop.background primary-color '#385518'
```

To make Tails "remember" your desired color, add *both* of these commands to the end of the `~/.xsessionrc` file.

```
$ cat .xsessionrc
. /etc/amnesia/environment
export TAILS_WIKI_SUPPORTED_LANGUAGES

gsettings set org.gnome.desktop.background picture-uri none
gsettings set org.gnome.desktop.background primary-color '#385518'
```

## Test

Reboot Tails, and unlock the persistent storage volume when it boots back up.

# References

* [`https://redmine.tails.boum.org/code/issues/8846`](https://redmine.tails.boum.org/code/issues/8846)

* [`https://wiki.archlinux.org/index.php/GNOME/Tips_and_tricks`](https://wiki.archlinux.org/index.php/GNOME/Tips_and_tricks)
