Can I put more applications in a Unity icon?

Overview

This answer gives two potential answers - Drawers and Quicklists

Drawers

Drawers is available via a PPA for 12.04:

enter image description here

sudo add-apt-repository ppa:ian-berke/ppa-drawers 
sudo apt-get update
sudo apt-get install drawers

Launch Drawers from Dash. For you drawer, drag and drop the created icon from ~/.local/share/applications.

Launch your drawer - then you can drag and drop your favourite applications from the Dash onto the drawer.

Graphical Quicklists

The default unity method to launch multiple options is through the use of quicklists - right-click a launcher icon to show a menu of options for that launcher icon.

enter image description here

The creation of quicklist using a graphical method for 12.04 is available using MyUnity

myunity Install myunity

enter image description here

This option allows you to create quicklists - quicklists are a submenu that are displayed when you right-click a launcher icon.

The creation of quicklist using a graphical method for 11.04 is work-in-progress - for example - the Unity Launcher Editor

enter image description here

This works in Natty (ubuntu 11.04) - but due to the python version change, does not work (as at the time of writing this) in oneiric (ubuntu 11.10)

to install

cd ~/Downloads
sudo apt-get install bzr
bzr branch lp:unity-launcher-editor

to run

cd ~/Downloads/unity-launcher-editor
./ule

Manual creation of quicklists

Fortunately, it is simple to create quicklists manually as well. A quicklist is a .desktop file containing at the minimum the following:

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon=adressbook
Name=Sample Menu
Exec=example_application1

X-Ayatana-Desktop-Shortcuts=example_app2;

[example_apps Shortcut Group]
Name=Name of Application 2
Exec=example_application2
TargetEnvironment=Unity

Let's break this down to the areas you should change (working from top to bottom of the example).

  • Icon=: this is the graphical picture file found in /usr/share/icons
  • Name=: this is the tooltip you see when you hover over the launcher icon
  • Exec=: this is the default executable run when you left click the launcher icon
  • X-Ayatana-Desktop-Shortcuts=: this is a semi-colon separated list of groups.

Each group is a quick-list menu option under the entry [group_name Shortcut Group]

  • example_apps this is the name of the group in the X-Ayatana-Desktop-Shortcuts field
  • Name=: this is the quicklist menu text
  • Exec=: this is the executable run when choosing the quicklist entry

.desktop files should exist in the local folder ~/.local/share/applications

If it doesn't already exist create this folder:

mkdir -p ~/.local/share/applications

Create a file in the folder - for example myquicklist.desktop and drag-and-drop this file from Nautilus into the Unity Launcher.

mimic XFCE launcher

The default XFCE action when clicking on the launcher button is to run an executable. For our launcher you could default to the calculator

Name=My Quicklist
Exec=gcalctool

The other action possible in the XFCE launcher is to just display the list of launcher items. Unfortunately in Unity you cannot do this - it must be a right-click.

The default Exec= must run something - for example you could use this to display a quick pop-up dialog reminding you to right click:

Name=My Quicklist
Exec=zenity --title="action" --info --text="Right-Click for quicklist" --height=50 --width=275 --timeout=2

Example

You gave the following examples that you wanted:

  • Screenshot: Exec=gnome-screenshot -i
  • Dictionary: Exec=xfce4-dict
  • Calculator: Exec=gcalctool

enter image description here

Thus your example .desktop file would look like:

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon=addressbook
Name=My Quicklist
Exec=zenity --title="action" --info --text="Right-Click for quicklist" --height=50 --width=275 --timeout=2

X-Ayatana-Desktop-Shortcuts=screenshot;dictionary;calculator

[screenshot Shortcut Group]
Name=Gnome Screenshot
Exec=gnome-screenshot -i
TargetEnvironment=Unity

[dictionary Shortcut Group]
Name=XFCE Dictionary
Exec=xfce4-dict
TargetEnvironment=Unity

[calculator Shortcut Group]
Name=Gnome Calculator
Exec=gcalctool
TargetEnvironment=Unity

Yes, you can use Launcher quicklists to add applications to the right click menu of a launcher icon. Look at this question:

  • What Custom Launchers and Unity Quicklists are available?

Specifically the libreoffice example can be modified to just run whatever applications you want under the same icon.


For Ubuntu 11.10 (Oneiric) and Unity (3D)

Example: "Ubuntu Toolbox" multi-purpose icon

Description: A single 'toolbox' icon, replacing multiple Unity launcher icons, for: Systems Settings (default), Ubuntu Tweak, Ubuntu Software Center, and Software Updates.

enter image description here

Comments: I did make some compromises on icons (not custom), file naming, and the default item. Other alternatives might clash or could be confused with existing items. (be warned)

mkdir ~/.local/share/applications  (if required)

gedit ~/.local/share/applications/toolbox.desktop &

Note: The ampersand '&' releases the command line immediately.

My custom 'toolbox.desktop' file: (can be easily edited)

[Desktop Entry]
Name=Ubuntu Toolbox
Comment=System Settings
Exec=gnome-control-center --overview
Icon=redhat-tools
Terminal=false
Type=Application
StartupNotify=true
Categories=GNOME;GTK;System;
OnlyShowIn=GNOME;Unity;
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-control-center
X-GNOME-Bugzilla-Component=shell
X-GNOME-Bugzilla-Version=3.2.1
X-Ubuntu-Gettext-Domain=gnome-control-center-2.0

X-Ayatana-Desktop-Shortcuts=UbuntuTweak;SoftwareCenter;SoftwareUpdates;

[UbuntuTweak Shortcut Group]
Name=Ubuntu Tweak
Exec=ubuntu-tweak
TargetEnvironment=Unity

[SoftwareCenter Shortcut Group]
Name=Ubuntu Software Center
Exec=software-center
TargetEnvironment=Unity

[SoftwareUpdates Shortcut Group]  
Name=Update Manager  
Exec=update-manager -c  
TargetEnvironment=Unity

Drawers are a perfect way to group applications in the Unity Laucher.

As of now, it is not available in the repos but you can still install it from the ppa.

sudo add-apt-repository ppa:ian-berke/ppa-drawers   
sudo apt-get update   
sudo apt-get install drawers

Some screenshots to show the use of drawers

enter image description here

enter image description here

Once you create a new drawer, you can drag & drop applications from the Dash.

You can even store files and folders in your drawer, providing a way of quickly accesing commonly used files.

enter image description here

Sources:
http://maketecheasier.com/group-apps-together-in-unity-launcher/2012/08/10
http://www.iloveubuntu.net/how-easily-group-items-featuring-their-own-mini-dash-unity-launcher-drawers