Loading...
Logo
Processing Forum
I didn't find any solution for this on the internet, so I came up with my own and thought I'd share in case anyone's having the same issue.

Nautilus in Ubuntu 12.10 doesn't allow you to create your own custom execution script (unlike earlier versions). The workaround is normally to create a desktop entry in /usr/share/applications/ called processing.desktop with contents something like the following:
Copy code
  1. $ sudo gedit /usr/share/applications/processing.desktop
  2. [Desktop Entry]
    Name=Processing
    Comment=Processing
    Exec=/home/paul/.processing-2.0.8 %F
    Terminal=false
    Type=Application
    Icon=processing
    Categories=GNOME;Graphics;
    StartupNotify=true
The Exec line basically says launch processing (customize the path to suit your installation) and the %F passes it the file path. However, nautilus doesn't execute this in the way that you'd expect it to work from the command line. Something to do with strings .... You end up launching an empty sketch. So instead, we'll create a little bash script called launchprocessingfile that DOES work as we'd expect, and point our processing.desktop file there instead:
Copy code
  1. [Desktop Entry]
    Name=Processing
    Comment=Processing
    Exec=launchprocessingflile %F
    Terminal=false
    Type=Application
    Icon=processing
    Categories=GNOME;Graphics;
    StartupNotify=true
Now we create the bash script (customize the path to suit your installation):
Copy code
  1. $ cd
  2. $ gedit launchprocessingfile
Contents of the file:
Copy code
  1. #!/bin/bash
    /home/paul/.processing-2.0.8/processing $1
Make the file executable:
Copy code
  1. $ chmod a+x launchprocessingfile
Now you should be able to launch a sketch by invoking the script with the sketch's absolute path as an argument:
Copy code
  1. $ ./launchprocessingfile /home/paul/sketchbook/bounce/bounce.pde
Place the file in a folder included in your $PATH variable:
Copy code
  1. $ sudo mv launchprocessingfile /usr/local/sbin/
If you want to check to make sure the folder IS in $PATH,
Copy code
  1. $ echo $PATH
Optionally, you can download a 48x48 pixel Processing icon, name it processing.png, and place it in /usr/share/pixmaps/ (matches line that says Icon=processing in the processing.desktop file above).

In Nautilus, right-click any pde file. Choose Properties. Click on the "Open With" tab, then "Show Other Applications" and select Processing from the list. Click "Set as Default", then close. pde files should now open with Processing by default!

Replies(1)

Thanks this was great help!

I had to do two changes to make it work with paths that contain spaces.

One, in your launcher script, I added quotes:

/home/paul/.processing-2.0.8/processing "$1"

Then I had to do the same in the official processing launch script. One of the readlink calls at the end of the file missed the quotes:

SKETCH=`readlink -f "$1"`

Now I can double click any file and it works. Thanks again for the instructions.

aBe