Nautilus is the default file manager in GNOME Desktop Environment. It has a lot of cool features, one of which is the Nautilus Scripts. This feature lets you add a “Right Click Menu Entry” and run some shell script. This is a very handy tool.
- In your home folder, you shall find hidden folder ( press ctrl + h to view it ) named “.gnome2″. Inside the folder a folder called “nautilus-scripts” should exist. If not create one.
- Now write your script and save it in the folder.
- Mark the script as executable. [ Right click > Permissions > Allow executing ]
- Log out and Log in. Fom now on, right clicking a file would show you an additional menu called “Scripts” which will list scripts available.
Nautilus passes the names of files selected as the arguements to the script. Hence these can be referred to as $1 , $2 etc in the script. ie If you right click on file name “Viva La Vida.mp3″ and run your script, then the string “Viva La Vida.mp3″ is stored in $1.
For example, the absence of the “Add to playlist” option in nautilus is disturbing for many. Let us create a nautilus script to solve the problem. The script will add the file to the queue of the default media player in gnome, totem [ Movie Player ].
The script would look like this :
Save it as “Add to Totem Playlist” and mark it as executable. Now Log out and Log in. Bingo !!! You have your own menu entry.