What distro and window manager are you using? I'll assume a standard gnome setup.
I'm not sure what you've finished already, but in case you don't know this already, any script that you put in ~/.gnome2/nautilus-scripts/ will show up in the right-click menu if it is executable (
chmod u+x filename for the unknowing).
If you want to use one script for all of the different file types, you'll need to detect what type of file you are working with to select the correct application to call. There are a few ways to do this:
1. Do a regex match against the filename.
2. (Recommended) Do a regex match against the output of '
file -b filename'
3. There is probably a cleaner way to do this that I don't know about.
You can set the display variable at the top of your script with
DISPLAY=:0.1For option 2, you might do:
Code:
#!/bin/bash
DISPLAY=:0.1
output=`file -b $1`
if [[ "$output" =~ 'AVI' ]]; then
totem $1
elif [[ ... ]]; then
...
fi
I don't know what the ouput of
file is for the different types that you want, so you'll need to test them out and construct your regexes accordingly.
- thobbs