Blog | Tech Blog | Secure Coding | Twitter | RSS Feed | Get Email Updates

I’m back from my vacation and this is a smallish post before we return to our regular programming (I’m full of puns  ).

Rahul (my friend and guest author on this blog) introduced me to an old-but-useful trick a few days ago that I didn’t know about. It’s about customizing nautilus to display a context menu that has a few of your chosen scripts to weave their magic on the selected object. And the procedure to do this is summarized in just two steps:


  1. Write your script.
  2. Save it in ~/.gnome2/nautilus-scripts and make it executable (chmod +x <script name>).

Of course, if you don’t know scripting the first step itself is quite daunting, but you can get a lot of pre-cooked scripts on the internet by searching for “nautilus scripts”. e.g. take a look at g-scripts homepage.

To get you started immediately, here is a crude example to open a terminal/console window in any folder/path through right-click menu:


Step 1) Write your script (any scripting language: shell, perl, python, etc):

CODE:
  1. #!/bin/bash
  2. gnome-terminal --working-directory="$1"

Step 2) Save it in ~/.gnome2/nautilus-scripts, name it as “Terminal” and make it executable.

CODE:
  1. chmod +x Terminal

Step 3) Now, you should see a “Scripts” option in your right-click menu as shown below. Clicking on “Terminal” will open a new terminal window with the present working directory being set to the selected folder.

Nautilus_scripts

Note: If you don’t see the “scripts” menu option (or your script name in the extended menu), then just run

CODE:
  1. sudo killall nautilus

Let me know if you face any problems with this or have any other questions.

© Shantanu Goel | Ubuntu TIP: Extending Nautilus, Scripting Your Way To UI Bliss

Custom Search
Liked this post? Get FREE Updates
Subscribe to RSS feed

Or
Enter Your E-mail ID below

Share and Enjoy:
  • Digg
  • del.icio.us
  • StumbleUpon
  • Facebook
  • Reddit
  • Print this article!

Related posts