[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.7 The GNUIT per file type action script

gitaction is a script that executes a different action for each file type specified. It is called by the gitfm program when pressing F2, ESC 2 or ^Xa.

The first parameter is the current directory name and the second one is the file name to be matched against the default patterns. The matching is done using the shell 'case' statement.

If you press F2, ESC 2 or ^Xa on a ‘*.html’ file, gitfm will invoke a browser to view it, if you press F2, ESC 2 or ^Xa on a ‘*.tar.gz’ file, gitfm will list the tar archive contents, if you press the same keys on a ‘*.gz’ file, gitfm will display its uncompressed contents on the screen, etc …

If you press F2, ESC 2 or ^Xa on a ‘*.gif’ file or ‘*.jpg’ file and you have the xzgv utility installed, you will be able to see it. If you want to change the gif/jpeg viewer, all you need to do is to change its name in the gitaction script.

There are many more file types and viewers that gitaction knows about. In addition, if you are running under GNOME, gnome-open is used, and on MacOS, open(1) is used. see(1) and metamail(1) are also used as fallbacks. If all else fails, the file is displayed using $GNUIT_PAGER.

If you want to find out what the default action for each file type is (or if you want to modify it), just read/modify the gitaction script.

Also, you can add a .gitaction shell script in your home directory and/or in any other directory. Before trying to match a file name, gitaction will attempt to execute ./.gitaction. If that one fails to match the file name against its patterns, it backs up to $HOME/.gitaction. When this one fails too the patterns in gitaction are tried. For an example of how to write .gitaction scripts take a look at the .gitaction shell script provided as part of the distribution and installed in the ‘$(prefix)/bin’ directory. Debian users will find it in ‘/usr/share/doc/gnuit/examples/’.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by Ian Beckwith on March, 1 2009 using texi2html 1.78.