Saturday, September 20, 2008

Adding new menu entries in Nautilus - I

We can make new bash scripts and just simply add them as a menu item in nautilus, thus harnessing the power of nautilus.
To add a new menu item, we need to install a package "nautilus action configuration".
Then from
system>preferences>nautilus actions configuration

Quote:
Menu Item And Action
Label: Hide This File
Tooltip: Add file to .hidden so that it is hidden
Icon: usr/share/pixmaps/nautilus/erase.png
Path: /home/YOURUSERNAME/.hidefile.sh
Parameters: %d %f

Conditions
Filenames: *
Mimetypes: */*
Selection Contains: both
Multiple Files: unchecked (no)

Advanced Conditions
Only local files

Restart nautilus by pressing alt-f2 and entering nautilus -q to quite (don't do this if you are currently copying files etc) then open go to places > home or any other location to restart. Alternately you can just logout and back in. Now when you right click on a file or folder there will be a Custom option as you named it.

Hiding Files in Nautilus

There are two ways one can hide his files from being displayed in nautilus browser.
  1. Renaming the files : One can rename the file, he wants to hide by just appending a "." at the beginning of the name of the file. For,e.g., we want to hide a file "Photo.jpg" , so we just rename the file to ".Photo.jpg"
  2. Without renaming the file : This is a better method, but works only with nautilus. We create a hidden file ".hidden" and just put the names of all those files we want to hide. So, as in the previous case we would just write "Photo.jpg" into the file .hidden
Just put the names in the file and press Ctrl+R or F5 and yooo !! the files are gone !

Xautomation

Today, I came across a really cool tool, "Xautomation" used by the alias xte.Using this, one can automate any mouse/keyboard driven process. The homepage of the project is : http://hoopajoo.net/projects/xautomation.html

Using this I was able to able to do things like refreshing the contents of a folder after I ran a script on the contents. This can also be used to test softwares faster by automating some of the usual input tasks.

For e.g., Lets say we want to press F5, then we can write
>> xte 'key F5'

If we want to press two keys together, for eg., Ctrl + R then we can say
>> xte 'keydown Control_L' 'key R' 'keyup Control_L'