How can I add Processing to the Unity launcher?
Sebastian Wright
Processing is an open-source language and environment for learning the fundamentals of electronic art and computer programming.
Its Linux download package includes a file called processing that, when run, opens the main Processing IDE.
How can I add this program to the Unity launcher in Ubuntu 13.10?
11 Answer
Install Processing
Once you have downloaded Processing it first needs to be unpacked.
tar zxvf processing-2.1-linux64.tgzThe processing file then needs to be copied to /usr/bin
cd processing-2.1
sudo mv processing /usr/bin/The rest of the files then need to be copied to the /opt directory.
sudo mkdir /opt/processing
sudo cp -r processing-2.1/* /opt/processing/The tldp website provides a great explanation of why to install to /opt
This directory is reserved for all the software and add-on packages that are not part of the default installation. For example, StarOffice, Kylix, Netscape Communicator and WordPerfect packages are normally found here. To comply with the FSSTND, all third party applications should be installed in this directory. Any package to be installed here must locate its static files (ie. extra fonts, clipart, database files) must locate its static files in a separate /opt/'package' or /opt/'provider' directory tree (similar to the way in which Windows will install new software to its own directory tree C:\Windows\Progam Files\"Program Name"), where 'package' is a name that describes the software package and 'provider' is the provider's LANANA registered name.
Although most distributions neglect to create the directories /opt/bin, /opt/doc, /opt/include, /opt/info, /opt/lib, and /opt/man they are reserved for local system administrator use. Packages may provide "front-end" files intended to be placed in (by linking or copying) these reserved directories by the system administrator, but must function normally in the absence of these reserved directories. Programs to be invoked by users are located in the directory /opt/'package'/bin. If the package includes UNIX manual pages, they are located in /opt/'package'/man and the same substructure as /usr/share/man must be used. Package files that are variable must be installed in /var/opt. Host-specific configuration files are installed in /etc/opt. Interpret this as you wish, but to my understanding you do this if you want to run a self-contained package i.e. one that contains all that is needed within the download itself.
Next it needs to be linked to java
cd /opt/processing
ln -s /usr/lib/jvm/java-6-sun javaAnd finally to create a link
sudo sed -i 's/APPDIR=`readlink -f "$0"`//'g /usr/bin/processing
sudo sed -i 's/`dirname "$APPDIR"`/\/opt\/processing/'g /usr/bin/processingCreate Unity launcher
With Processing now "installed" the launcher can now be made. The Ubuntu website provides a good tutorial of this, which is summarised below. First, create the launcher
sudo touch /usr/share/applications/processing.desktopAnd then open it for editing
sudo gedit /usr/share/applications/processing.desktopWith the file now open fill it with the following information and save.
[Desktop Entry]
Version=2.1
Name=Processing
Comment=graphics and animation language
Exec=processing
Icon=/opt/processing/lib/icons/pde-256.png
Terminal=false
Type=Application
Categories=AudioVideo;Video;Graphics;With that now saved you should be able to find Processing in the Unity Dash
Upgrading will require you to just copy over the files in /opt/processing with the new ones, though do check that the directory and file structure is the same as before.
Associate .pde files with Processing
Finally, to associate .pde files with Processing - so double-clicking a .pde launches Processing - you need create a new MIME type and associate Processing with that type.
The GNOME dev center provides an explanation of how to create a new MIME type. First, create the new MIME type
sudo touch /usr/share/mime/packages/processing.xmlThen open it for editing
sudo gedit /usr/share/mime/packages/processing.xmlPut the following data in that file and then save it
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns=""> <mime-type type="text/x-processing"> <comment>Proecssing source code</comment> <sub-class-of type="text/x-csrc"/> <glob pattern="*.pde"/> </mime-type>
</mime-info>Update the MIME database
sudo update-mime-database /usr/share/mimeFinally, associate the new MIME type with Processing. The default applications list is stored in a file called defaults.list
sudo gedit /usr/share/applications/defaults.listAdd text/x-processing=processing.desktop somewhere in that file.
Now, when you double-click a .pde file it'll open the file Processing.
5