9

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.

Processing IDE screenshot

How can I add this program to the Unity launcher in Ubuntu 13.10?

  • Thanks for your answer, it works great! There's an error where it says: [Desktop Entry] Version=2.1 Name=Processing ... It should be: [Desktop Entry] Version=2.1 Name=Processing ... I tried editing but it's a less than 10 character and it doesn't allow me to. – user262880 Mar 28 '14 at 8:59
12

Install Processing

Once you have downloaded Processing it first needs to be unpacked.

tar zxvf processing-2.1-linux64.tgz

The 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 java

And 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/processing

Create 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.desktop

And then open it for editing

sudo gedit /usr/share/applications/processing.desktop

With 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

Processing in 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.xml

Then open it for editing

sudo gedit /usr/share/mime/packages/processing.xml

Put the following data in that file and then save it

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
    <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/mime

Finally, 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.list

Add text/x-processing=processing.desktop somewhere in that file.

Now, when you double-click a .pde file it'll open the file Processing.

  • I was able to create a unity launcher file successfully, but when I click on the icon, nothing happens. I'm forced to run it using ./processing – SY_13 Aug 2 '15 at 11:07
  • I followed the steps carefully and didn't notice anything wrong. I've also changed the version no. wherever needed. – SY_13 Aug 2 '15 at 11:08
  • Probably you want to link to default-java instead of java-6-sun. – YoYoYonnY Oct 6 '16 at 18:46
  • Thanks. Everything is working. But now the pde file has icon as txt file. How to have the icon with blue C back. – Sigur Oct 11 '16 at 2:33
  • thank you. worked perfectly with ubuntu 16, processing-3.2.3 and Java 8. – lakesare Nov 30 '16 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.