# XFILER

Section: User Commands (1)
Updated: 12 April 1999
Index

## NAME

xfiler - X file manager with drag and drop capabilities

## SYNOPSIS

xfiler [-version] [directories ...]

## DESCRIPTION

Xfiler is a file manager program for the X window system formely known as files, and before that as xfm. It provides virtually all of the features that you would expect in a file manager - move around your directory tree in multiple windows, move, copy or delete files, and launch programs with simple mouse operations. Directory displays are updated automatically in regular intervals when the contents of the directory changes. User-definable file types let you specify a command to be executed when double-clicking on a file. Last but not least, xfiler can automatically mount and unmount special devices like floppies as you open and close the corresponding directories (mount points).

## OPTIONS

xfiler accepts a list of directories as command line arguments. For each directory, xfiler opens a file window. If no directory is given, the user's home directory will be used.

## USAGE

Most of it should be fairly obvious. There is one or more file windows in which directories (also termed folders) are displayed. In order to perform an action, you either select items and then invoke a menu operation, or you drag items from a file window to a second (maybe the same) file window. You can also double-click on an item to start a corresponding action (like launching an application, editing a file, or changing directories), and press the right menu button on an item to bring up a menu containing operations for a single file or application. File operations are accessed from the file window menu bar as usual.

The left-hand mouse button selects an item (and deselects all others in the same window). The second button toggles the selected state of an item.

You can drag with the left-hand button to another window to move files from one directory to another. The second button used in the same way will copy files. New file windows can be opened by simply dragging a directory icon to the root window.

The action taken when double-clicking on a file depends on the type of the file. If it is a directory, it is displayed in the file window. If it is an executable, the program is started. Other files are opened in the default editor (specified by the defaultEditor resource), unless another action is given in the rc file (see CONFIGURATION below).

Directories can be displayed in three different forms: tree (display subdirectories in tree-like form), icon (display directories and files as icons) and text (similar to ls -l). These options are selected from the View menu. In the tree form, clicking on the arrows takes you up or down one level.

Directory displays are updated automatically in regular intervals when the contents of the directory changes. You can also explicitly request a folder update by double-clicking on the directory name field of the corresponding file window.

## MENU COMMANDS

FILE MENU

File manipulation operations.

New...
  Create a new (and empty) file.
Move...
  Rename a single item (directory or file) or move selected items to another directory.
Copy...
  Create a copy of a single item under a new name or copy selected items to another directory.
Link...
  Like Copy, but creates symbolic links rather than copying the selected items.
Delete
  Delete the selected items.
Select...
  Select items by pattern. The usual metacharacters are recognized (*, ?, [ ]). (Currently there is no provision for escaping these.)
Select all
  Select all items in the current directory (except the parent directory).
Deselect
  Deselect all items.
Quit
  Terminate xfiler.

FOLDER MENU

Operations dealing with directories and the file window.

New...
  Create a new directory.
Go to...
  Display the specified directory.
Home
  Display your home directory.
Up
  Display the parent directory.
Empty
  Delete all items in the current directory.
Close
  Close this file window.

VIEW MENU

Options for the directory display.

Tree
  Select the tree form display.
Icons
  Select the icons form display.
Text
  Select the text form display.
Sort by name
  Sort directory by name.
Sort by size
  Sort directory by size.
Sort by date
  Sort directory by date.
Filter...
  Specify a pattern to determine the files which should be displayed in the file window. (This only affects normal files, i.e. directory items will not be filtered. The Clear button in the Filter dialog form reverts to the full display.)
Hide folders
  Suppress directory items.
Mix folders/files
  Mix directories and other files.
Show hidden files
  Show hidden files (files starting with a dot).

FILE POPUP MENU

Operations on a single file. This menu pops up when pressing the right mouse button on a directory or file icon.

Open
  Open a file window on the selected item. This option is only available if the selected item is a directory.
Edit
  Edit the selected item using the program specified in the defaultEditor resource (only available if the selected item is not a directory).
View
  Same as Edit, but invokes a program for viewing the file (defaultViewer resource).
Move...
  Move the selected item.
Copy...
  Copy the selected item.
Link...
  Create a symbolic link.
Delete
  Delete the selected item.
Information...
  Display information about the selected item (file size, permissions and such).
Permissions...
  Change the permissions of the selected item.

## RESOURCES

Various aspects of xfiler can be configured by changing corresponding resource settings in the applications default file. Some important resources are listed below:

bitmapPath
pixmapPath
  The path on which to search for bitmap and pixmap icons, respectively.
configFile
  The names of the system-wide configuration file used by Xfiler (see CONFIGURATION).
doubleClickTime
  Set the time interval in milliseconds for which a sequence of two mouse clicks should be interpreted as a double click. Default: 300.
updateInterval
  Set the time interval in milliseconds in which to perform automatic folder updates. Default: 10000.
confirmXXX
  Resources to request confirmation for various operations. XXX can be any one of Deletes, DeleteFolder, Copies, Moves, Overwrite and Quit. By default these are all enabled.
defaultEditor
  The command with which xfiler invokes your favourite editor.
defaultViewer
  The command with which xfiler invokes your favorite viewer.
BourneShells
  Xfiler calls other programs by executing your shell (as taken from the environment variable SHELL). Since Bourne compatible shells need one extra parameter, xfiler needs to know about the type of the shell. If this resource is not set (default), or is equal to the special string AUTO, a quick-and-dirty test is done at startup. Set the BourneShells resource to a comma separated list of full path names of Bourne compatible shells if you experience problems. If your shell matches an entry in this list, xfiler will assume it is a Bourne shell.

There are way too many available resources to list them all in this manual page, so please take a look at the application defaults file for more information.

## CONFIGURATION

Besides the application resources, xfiler can be configured by means of a configuration file called .Filesrc located in your home directory. If this file is not found, xfiler search for a system-wide one. The location of such file may vary and can be adjusted using the corresponding X resource. It is a plain ASCII file which can be edited using any text editor. Any line in this file which starts with a hash sign (#) is interpreted as a comment; empty lines are ignored. Note that there exists a line splitting this file in two parts: file type configuration and device configuration. Also, if xfiler has been compiled with the MAGIC_HEADERS option then another file called FilesMagic (system-wide) or ~/.FilesMagic is used (see below).

## FILE TYPE CONFIGURATION

The first half of the Filesrc file specifies the types of ordinary (non-executable, non-directory) files which xfiler should recognize. Each file type associates a pattern with an icon and two different kinds of actions (commands to be executed on the file). If xfiler has been compiled with the MAGIC_HEADERS option then it is possible to specify icons (but not actions) for directories and executables as well. Each line has the following format:

            pattern:icon:push-action:drop-action

As indicated, the different fields are separated by a colon (use \: to escape the : character, and \\ to escape the backslash character itself). The meaning of these fields is explained below.

pattern
  This field allows you to specify which files belong to the type. File types can either be specified by a filename pattern, which refers to the name of a file, or a magic header, which refers to the contents of the file, or both.

  There are three types of filename patterns: Literal patterns specify a literal filename such as ``core.'' Suffix patterns specify a suffix the filename must match, and are indicated by a leading asterisk, as in ``*.c.'' (All characters following the initial * are interpreted as literals; there is no expansion of embedded wildcards.) Finally, prefix patterns specify a prefix to be matched against the filename. They are denoted by a trailing asterisk, as in ``README*.''

  Magic headers are specified by a symbolic name given in the FilesMagic file, enclosed in angle brackets. Entries referring to a magic header cause the contents of the file to be checked against the magic numbers in the FilesMagic file. The format of these entries is described in Section MAGIC HEADERS below.

icon
  The name of the bitmap or pixmap file containing the icon to be displayed for this file type.
push-action
  The command to be executed when the user double-clicks on a file of this type. This command is passed to the shell (via -c), together with the name of the selected file. The command is executed in the directory where the selected file is located. The filename is available in the command as the positional parameter number one, such that an action of the form xyz $1 invokes the command xyz on the selected file. There are also two special kinds of push actions built into xfiler, EDIT and VIEW which invoke the default editor and default viewer on the selected file, respectively.
drop-action
  Similar to the push action, this field denotes a command to be executed when a collection of selected files is dropped onto the file. The absolute target filename itself is available as positional parameter $1, the remaining arguments denote the names of the files dropped onto the target file. The command is executed in the directory which contains the selected files. No special built-in commands are available for this type of action.

If an action field is empty, the corresponding action defaults to ``do nothing.'' For instance, the following entry defines an icon and an EDIT push action for .c files:

            *.c:files_c.xpm:EDIT:

As another example, here is an entry for compressed (i.e. gzipped) tar files. The push action causes the archive to be extracted, while the drop action replaces the contents of the archive with the files which have been dragged onto the archive:

            *.tar.gz:files_taz.xpm:exec tar xfvz $1:exec tar cfvz $*

(Note the use of the shell's exec command. Since actions are invoked through the shell, it is often useful to replace the shell with the actual command which is to be executed, in order to conserve memory space on small systems.)

It is possible that different patterns given in the filesrc file overlap. In this case xfiler uses the first pattern which matches. Therefore you should always list the more specific patterns first. For instance, the following two entries specify what to do with compressed tar files (specific case) and other .gz files (default case):

            *.tar.gz:files_taz.xpm:exec tar xfvz $1:exec tar cfvz $*
            *.gz:files_z.xpm:exec gunzip $1:

xfiler also enables you to prompt for additional parameters before an action is executed. This is generally more useful with application entries than with file actions, and will therefore be described in the context of application configuration, see PARAMETER DIALOGS below.

## DRAG AND DROP OPERATIONS

xfiler handles the following DND types: DndFile, DndExe, DndLink, DndFiles, DndRawData and DndText. DndText and DndRawData are ignored unless the drop occurred over a dir icon or over an empty region of the file window (called iconbox). Over the iconbox or a dir icon a new file is created and the DND data is thrown into it. Other kinds of drops are treated according to the target. Over icons with drop actions the corresponding action is executed in the directory of the target; the target name and the DND data are passed as parameters. When the drop occurs over an executable file that file is executed in its directory and the DND data is used as parameters. Over dir icons or the iconbox, a distinction between internal and external (drops that come from another application) is made; external drops are ignored while internal ones yield move/copy operations. Drop made over other kind of icons are ignored.

## MAGIC HEADERS

When compiled with the MAGIC_HEADERS option, xfiler can determine file types using the magic numbers contained in the files.

The magic numbers are described in a configuration file whose path is obtained from the magicFile resource. The format of the file is the same as that of the magic(5) file, with some extensions like regular expression matching. (See xfmtype(1).)

There are five built-in types which are used if all the patterns in the magic file fail:

unreadable
  Read failed.
empty
  File size is zero.
special
  Not a regular file.
ascii
  Could be read and looks like ASCII.
data
  Could be read but all tests failed and doesn't look like ASCII.

To specify a magic file type you include it between angle brackets at the beginning of the pattern field:

            <GIF>:files_gif.xpm:exec xpaint $1:

or combined with a filename pattern:

            <ascii>*.cc:files_cc.xpm:EDIT:

In the latter case, the file must meet both conditions, i.e. be an ASCII file and have a .cc suffix.

To include angle brackets in the type or the pattern you must escape them using backslashes.

If xfiler is compiled with the MAGIC_HEADERS option, it is also possible to specify custom icons for directories and executables. For this purpose, the magic file distributed with xfiler provides magic file types named <DIR>, <EXEC>, etc. For instance, here is an entry which specifies a special icon for hidden directories:

            <DIR>.*:hidden_dir.xpm::

In the same way you can also override the built-in icons for displaying arbitrary directories and executables:

            <DIR>..:parent_dir.xpm::
            <DIR>:plain_dir.xpm::
            <DIR LNK>:link_dir.xpm::

## DEVICE CONFIGURATION

The device configuration section of filesrc, lets you specify which mount points xfiler should keep track of, and which actions to perform in order to mount and unmount the corresponding file systems. This allows you to access file systems on special devices such as floppies, CD-Roms, etc. in a transparent way. All you have to do is to enter a directory named in filesrc (e.g. by opening a file window on it), and xfiler will automatically perform the corresponding mount action for you. Likewise, if you leave such a directory, xfiler invokes the corresponding unmount action. (CAUTION: You still have to take care that you unmount a file system, e.g. by closing every file window which has been opened on it, before you physically remove the corresponding medium.) Alternatively, it is recommended that you use external utilities like supermount to perform such operations without any risk of data loss.

An entry of the devide section has the following format:

            directory:mount-action:umount-action

The directory field denotes the mount point of the file system, mount-action the command to be executed in order to mount the file system, and umount-action the command for unmounting the file system. Here is a ``typical'' entry from a filesrc file:

            /disk/a:mount -t msdos -o user /dev/fd0 /disk/a:umount /disk/a

Of course, the details of how to mount a floppy file system may vary from system to system, and you might have to take special actions if you want to use mount as an ordinary user. See mount(8) for details.

## PARAMETER DIALOGS

xfiler lets you prompt the user for additional parameters when a push or drop action is invoked. In such a case, a dialog form appears, with one field for each parameter, into which the user can enter the required arguments. Currently, no checking is done on the supplied parameters; in fact, the user can simply leave all fields empty. Parameters are specified in an action using the form

            %parameter-name%

where parameter-name is an arbitrary string not containing the % character, which will be displayed in the dialog form. (As usual, a literal % character can be escaped with the backslash.) xfiler replaces each such %...% construct with the corresponding value entered by the user.

## CONSOLE OUTPUT

Programs started by xfiler inherit their standard output and error streams from xfiler. Therefore, if you start xfiler from your session or window manager instead of an xterm, you should redirect xfiler's standard output and error to something which you can read while xfiler is running, if the window manager does not already do that for you. Usually, you will reassign both stdout and stderr to /dev/console, using the command:

            xfiler >/dev/console 2>&1

Then you can read error messages and other output produced by launched applications in the console window on your desktop (such as xconsole, or xterm -C).

## ICONS

xfiler supports icons in both the X bitmap and Arnaud Le Hors' XPM format. A collection of useful icons is included in the distribution.

## FILES

~/.Filesrc
  Standard location for xfiler configuration file.

## SEE ALSO

X(1), xconsole(1), xterm(1), mount(8), Arnaud Le Hors: XPM Manual. The X PixMap Format, Groupe Bull, 1993. The Drag and Drop HOWTO by Cesar Crusius.

## CAVEATS AND BUGS

xfiler catches the TERM signal to gracefully terminate the program, unmounting all open file systems which have been mounted by xfiler. However, some window and session managers may not send TERM signals to their client applications when terminating an X session. Therefore it might be necessary to explicitly quit xfiler or manually close file windows before exiting X.

xfiler depends on your shell - see resource BourneShells.

Overwriting a directory while moving does not work.

## COPYRIGHT

Copyright (c) 1990-1993 by Simon Marlow
Copyright (c) 1994, 1995 by Albert Graef
Copyright (c) 1996 by Andre Hentz
Copyright (c) 1999 by Ulric Eriksson

## AUTHORS

The original version of this program (called xfm) was written by Simon Marlow (simonm@dcs.glasgow.ac.uk) at the University of Glasgow. Albert Graef (ag@muwiinfa.geschichte.uni-mainz.de) at the University of Mainz is the author of the lastest xfm version (1.3.2) which contains many bug fixes and enhancements. Other people have contributed additional features: Dave Safford (dave.safford@edu.tamu.sc; automatic folder updates); Robert Vogelgesang (vogelges@rhrk.uni-kl.de; shell detection code); Juan D. Martin (juando@cnm.us.es; magic headers); Kevin Rodgers (rodgers@lvs-emh.lvs.loral.com; Filter option); Scott Heavner (sdh@falstaff.MAE.cwru.edu; View option); Brian King (ender@ee.WPI.EDU; default values in parameter dialogs).

In 1996, this program underwent a complete reformulation in order to be able to work together with DnD (the Drag and Drop protocol by Cesar Crusius). Many features of earlier versions were removed due to the new role played by xfiler in the context of OffiX. OffiX is an expandable environment built around DnD and aimed to give novice and expert users a comfortable and common desktop.

In 1999 this code was snarfed by Ulric Eriksson to become part of Siag Office. At the same time, the user interface was redesigned to conform to the other Siag cousins. Intended as a small baseline file manager, it is available for all file management needs, but can be configured away.

## Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
USAGE
MENU COMMANDS
RESOURCES
CONFIGURATION
FILE TYPE CONFIGURATION
DRAG AND DROP OPERATIONS
MAGIC HEADERS
DEVICE CONFIGURATION
PARAMETER DIALOGS
CONSOLE OUTPUT
ICONS
FILES
SEE ALSO
CAVEATS AND BUGS
COPYRIGHT
AUTHORS

Ulric Eriksson - April 1999 - ulric@siag.nu