Ubuntu – How to add an icon to the unity dock (not drag and drop)

live-cdunityunity-2d

I am creating a custom ubuntu live cd and I want to add a few items to the default dock. I think there must be something i can put in /etc/skel so that when the 'ubuntu' user is created at boot time it already has a customised dock.

There are several posts about creating a .desktop file and putting it in .local/share/applications and then dragging it into the dock. This does not help me as it would mean that the livecd user would have to do the dragging and dropping.

Is there a setting file that lists what is currently shown in the dock?

Ideally I want something that works on unity and unity-2d.

Best Answer

You need to change defaults for gsettings key named com.canonical.Unity.Launcher favorites

You can get it's contents with gsettings get com.canonical.Unity.Launcher favorites and then replace get with set and add new favorites enclosing them in ".

For example:

gsettings set com.canonical.Unity.Launcher favorites "['gnome-terminal.desktop', 'firefox.desktop', 'chromium-browser.desktop' ]"