Thursday, 4 April 2013

Open with script in Gnome/Ubuntu

I always liked the feature open with script which was there in old ubuntu. I have no clue why they removed it. However as always in Linux there is always a way to do anything! Today I will show you a simple way( complex than before though ) to do it. Using this I was able to install Picasa Photo Viewer, Logism, yEd, MS Office..etc on my Ubuntu \m/

Step 1: Find MimeType of the target file (the file you want to open). You can find it in file properties

Step2: Download this gist. And make it executable:

$ chmod +x

Step3: Then run the script and enter necessary details. For example I was trying to install yEd, an awesome Software Engineering Drawing tool. This is what I did:
NOTE that if the command is <command> <file name> enter as <command> %U

Step4: This step is optional. This is to set font to the script. If you don't wanna do it, skip it. Open application called "Main Menu" or alacarte which comes by default in ubuntu. Then search for the script you just added and then set the font.

Step5: Now just set the file to open with the script by default if necessary using file properties.

Now you can simply open the file using yEd by default. So you are done!!!