Ubuntu – How to either lock items in the launcher OR restore a set of items in the launcher

launcherunity

I admin a batch of Ubuntu 14.04 desktop machines in a public library (they are diskless and boot via DRBL). Sometime users (I'm guessing kids) remove icons from the launcher. I want to either prevent that or have a simple means of restoring the launcher's state (eg via an autostart script). How can I do that? I found this (old) thread http://ubuntuforums.org/showthread.php?t=2023390, but there are no specific details and I can't seem to figure out how to use dconf.

Best Answer

The current configuration of most areas of the desktop can be viewed using Dconf Editor, or using the command line utility gsettings:

gsettings get com.canonical.Unity.Launcher favorites

Example output:

['application://nautilus.desktop', 'application://firefox.desktop', 'application://libreoffice-writer.desktop', 'application://unity-control-center.desktop', 'unity://running-apps', 'application://gnome-terminal.desktop', 'unity://expo-icon', 'unity://devices']

You can then use to restore it to that state (try removing things from the launcher, you can see any changes), using the set option (note the quotes ") with the output from the get command:

gsettings set com.canonical.Unity.Launcher favorites "['application://nautilus.desktop', 'application://firefox.desktop', 'application://libreoffice-writer.desktop', 'application://unity-control-center.desktop', 'unity://running-apps', 'application://gnome-terminal.desktop', 'unity://expo-icon', 'unity://devices']"

So if you get the launcher in the state you want, and use the get to get it, you can then set it back later with the set command. You could add this in gnome-session-properties and then it should set itself on login:

enter image description here

See also: https://askubuntu.com/a/367590/178596