For example, opening Mac OS X's file manager is done by executing open -a Finder on the current directory.
At boot time, muCommander tries to analyse which system it's running on and create the corresponding commands.
Since version 0.8 beta 3, it is possible for users to tweak these commands and change them to better fit their needs. This is achieved through two different configuration files: commands.xml and associations.xml. This section focuses on custom commands, but you can learn more about custom associations in another post.
The commands.xml file is located in your muCommander preferences folder, and looks something like this:
- Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<commands>
<command alias="Safari" value="open -a Safari $f"/>
<command alias="Mail" value="open -a Mail $f"/>
<command alias="Preview" value="open -a Preview $f"/>
<command alias="open" value="open $f" type="system"/>
<command alias="openFM" value="open -a Finder $f" type="system" display="Finder"/>
<command alias="openURL" value="open $f" type="system"/>
</commands>
Commands declared in that file can be associated to specific file types (executable files, files that match .*java...), muCommander actions (open URL), and displayed in the contextual Open with... menu.
Each commands has up to 4 attributes:
- alias (compulsory). A command's alias is used to identify and reference it accross the system. It has to be unique, and if you're updating a command, it's always safer not to change its alias.
- value (compulsory). What will be executed when the command is triggered. You can use special tokens there: $f for the file's full path, $n for its name, $p for its parent directory and $j for the JVM's startup directory.
- type. This can be set to system, invisible or left unspecified. For the time being, it is safer to either leave that attribute unspecified or set it to invisible, the difference being that invisible commands won't appear in the Open with... menu.
- display. That's the name under which the application will be displayed to users - well, in the Open with... menu, really. If this attribute is not present, then the command's alias will be used when it's displayed.
Let's take a few examples to make that clearer.
- Code: Select all
<command alias="Safari" value="open -a Safari $f"/>
This creates a new command which:
- will open a file in Safari.
- will be visible to users in the Open with... menu.
- will be refered to in the system as Safari.
- will be displayed to users as Safari
- Code: Select all
<command alias="iexplorer" value="c:\Program Files\Internet Explorer\iexplore.exe $f" display="Internet Explorer"/>
This creates a new command which:
- will open a file in Internet Explorer.
- will be visible to users in the Open with... menu.
- will be refered to in the system as iexplorer.
- will be displayed to users as Internet Explorer.
- Code: Select all
<command alias="textedit" value="/usr/bin/emacs $f" type="invisible"/>
This creates a new command which:
- will open a file in Emacs.
- will not be visible to users.
- will be refered to in the system as textedit.
From these examples, the importance of the alias attribute might not be obvious. There are, however, 4 hard-coded system aliases with very specific meanings for muCommander:
- open
- openURL
- openFM
- openEXE
open is used to open files. If it's defined and muCommander hasn't found a command that could open a specific file type, open will be used.
Note that if it's not defined, odds are that muCommander will be fairly useless. We're trying to provide working default values for known systems, but if you find yourself in a situation where muCommander just won't open files, you might need to find your system's 'file opener' and register it as the open command.
openEXE is used to open executable files. Under most known systems, there is no need to have a special case for executable files, but if muCommander finds itself running on an unknown environment, it will assume that executable files should be opened using the openEXE command. It's default value is $f (run the file itself), but if that doesn't work on your current system, you can toy around with openEXE's value to fix this.
Due to Sun's tardiveness in supporting file permissions, muCommander will only be able to decide whether a file is in a fact an executable or not if you're running under Java 1.6 or later. If you're not, muCommander will assume that any file that doesn't have an extension is an executable. We suggest that you upgrade your Java version.
openFM is used by muCommander when it needs to open a file in the system's File Manager. If this command is not defined, the Reveal in Deskop action will be disabled. This is the only system command that needs a display attribute.
openURL is used by muCommander when it needs to open an URL in the system's default browser. If this command is not defined, all actions that involve opening an URL will be disabled (Go to homepage, Download new version, ...).
The default registered commands per system are:
MAC OS X:
- Code: Select all
<command alias="open" type="system" value="open $f"/>
<command alias="openURL" type="system" value="open $f"/>
<command alias="openFM" type="system" value="open -a Finder $f" display="Finder"/>
Windows 9x:
- Code: Select all
<command alias="open" type="system" value="start "$f""/>
<command alias="openURL" type="system" value="start "$f""/>
<command alias="openFM" type="system" value="start "$f"" display="Explorer"/>
Windows NT:
- Code: Select all
<command alias="open" type="system" value="cmd /c start "" "$f""/>
<command alias="openURL" type="system" value="cmd /c start "" "$f""/>
<command alias="openFM" type="system" value="cmd /c start "" "$f"" display="Explorer"/>
<command alias="openEXE" type="system" value="cmd /c $f"/>
*nix running on KDE:
- Code: Select all
<command alias="open" type="system" value="kfmclient exec $f"/>
<command alias="openURL" type="system" value="kfmclient openURL $f"/>
<command alias="openFM" type="system" value="kfmclient exec $f" display="Konqueror"/>
*nix running on Gnome:
- Code: Select all
<command alias="open" type="system" value="gnome-open $f"/>
<command alias="openURL" type="system" value="gnome-open $f"/>
<command alias="openFM" type="system" value="gnome-open $f" display="Nautilus"/>
<command alias="openEXE" type="system" value="$f"/>
Anything else:
- Code: Select all
<command alias="openEXE" type="system" value="$f"/>
