Modify Desktop/Launcher

Asked by Mike Whittaker

I want to add one or more applications to the Desktop or Launcher.

I tried adding a .desktop file (with +x permission) to the chroot /usr/share/applications but the app icon did not show up on the Desktop in the final running LiveCD system.

Where should I place such files to them get built-in ?

Question information

Language:
English Edit question
Status:
Answered
For:
Cubic Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Cubic PPA (cubic-wizard) said :
#2

When you say "Desktop" are you talking about the dock at the left edge of the screen, or are you talking about the actual desktop area?

Revision history for this message
Mike Whittaker (mikejbw) said :
#3

Actual Desktop area - Or Launcher if that is easier. Basically available via one click from the UI, and immediately visible on start.

Revision history for this message
Cubic PPA (cubic-wizard) said :
#4

OK. I will show you both options...

[1] Regular Desktop Icon
[2] Add Icon to Dock

--------------------------------------------------------------------------------

[1-A] Regular Desktop Icon

The /etc/skel directory contains files and directories that are automatically copied over to a new user's home directory. (See http://www.linfo.org/etc_skel.html).

To create a desktop icon, copy the desktop file into the "skel" directory, and make it executable (so it is a trusted application). Here is an example with the Calculator application.

Inside Cubic...
$ mkdir /etc/skel/Desktop
$ cp /usr/share/applications/org.gnome.Calculator.desktop /etc/skel/Desktop/
$ chmod u+x /etc/skel/Desktop/org.gnome.Calculator.desktop

[1-B] Show Desktop Icons

Of course, the user must have "Show Desktop Icons" enabled in order to see any icons you've added to his/her desktop. The user can manually enable this using Gnome Tweak Tool (by navigating to the "Desktop" tab and turning on the "Show Icons" radio button).

However, you probably want the user's desktop to always show all icons, by default, so the use doesn't have to manually enable it. Here the steps to accomplish this:

Outside Cubic...

Use an editor (such as Gedit) to create a file with the following contents...

[org.gnome.desktop.background]
show-desktop-icons = false

Save the file with the name "90_ubuntu-settings.gschema.override". (Actually, you can name it whatever you want, but it must start with "90_" and it must have the extension ".override". This is a dconf configuration file which will be loaded when Ubuntu starts. The "90_" tells Ubuntu to load it ~after~ it has finished loading other dconf configurations, so your file takes precedence.

Inside Cubic...

Navigate to the /usr/share/glib-2.0/schemas/ folder...

$ cd /usr/share/glib-2.0/schemas/

Now drag your new "90_ubuntu-settings.gschema.override" file onto the Cubic chroot window.
This will copy the file to the correct location.

Finally, compile your dconf schema (inside Cubic)...

$ glib-compile-schemas /usr/share/glib-2.0/schemas/

After compelting steps [1-A] and [1-B] all users will have the Claculator ison in their Desktop folder, and they will have "Show Desktop Icons" enabled by defalt.

--------------------------------------------------------------------------------

[2] Add Icon to Dock

You can also add an icon to the dock at the left side of the screen.

First, get a list of all the apps in the dock...

Inside Cubic...

$ gsettings get org.gnome.shell favorite-apps

You will get somethig like this.

['ubiquity.desktop', 'firefox.desktop', 'thunderbird.desktop', 'org.gnome.Nautilus.desktop', 'rhythmbox.desktop', 'libreoffice-writer.desktop', 'org.gnome.Software.desktop', 'yelp.desktop', 'ubuntu-amazon-default.desktop']

Copy the above text using the right-click context menu in Cubic.

Outside Cubic...

Use an editor (such as Gedit) to create a file with the following contents...

[org.gnome.shell]
favorite-apps =

Then paste the text you had copied, after the "=" sign. Decide where in the list you want your new application to appear, and insert that as well.

For example, I've added Calculator as the 1st application in the user's dock. (Note that 'ubiquity.desktop' would show up as the first application in the live environment, but it would be uninstalled when you install your OS from your custom iso).

[org.gnome.shell]
favorite-apps = ['ubiquity.desktop', 'org.gnome.Calculator.desktop', 'firefox.desktop', 'thunderbird.desktop', 'org.gnome.Nautilus.desktop', 'rhythmbox.desktop', 'libreoffice-writer.desktop', 'org.gnome.Software.desktop', 'yelp.desktop', 'ubuntu-amazon-default.desktop']

Save the file with the name "90_ubuntu-settings.gschema.override". (Actually, you can name it whatever you want, but it must start with "90_" and it must have the extension ".override". This is a dconf configuration file which will be loaded when Ubuntu starts. The "90_" tells Ubuntu to load it ~after~ it has finished loading other dconf configurations, so your file takes precedence.

Inside Cubic...

Navigate to the /usr/share/glib-2.0/schemas/ folder...

$ cd /usr/share/glib-2.0/schemas/

Now drag your new "90_ubuntu-settings.gschema.override" file onto the Cubic chroot window.
This will copy the file to the correct location.

Finally, compile your dconf schema (inside Cubic)...
$ glib-compile-schemas /usr/share/glib-2.0/schemas/

After compelting steps [1] and [2] all users will have the Claculator ison in their Desktop folder, and they will have "Show Desktop Icons" enabled by defalt.

--------------------------------------------------------------------------------

As you can see, you can control what is inside the users home directort using the /etc/skel folder.

You can also control almost any user settings buy adding them to your new dconf configuration file in /usr/share/glib-2.0/schemas/.

You can even set the user's default background and fonts this way!

(The dconf settings work for gnome based distros like Ubuntu; other Ubuntu flavors like Kubuntu use different mechanisms to set user preferences).

Can you help with this problem?

Provide an answer of your own, or ask Mike Whittaker for more information if necessary.

To post a message you must log in.