<- back to Pixel's home page mirrors : chez, linuxbox, geocities

sfm (Simple File Manager)


Download


Screenshots

(the window manager is `icewm')

Documentation


<- back mirrors : chez, linuxbox, geocities

Changes file

29 january 99: just some few modifications to make sfm gtk+ 1.1 compliant (well, in fact, to make it compile :)

21 july 98: changed the address of the FSF in the copyright (Boston instead of Cambridge)

14 july 98: changed the packaging of sfm-*-bin-i386.*.tgz to include the man page, the docs and the .sfm-example file. Now the tgz is more like what is needed by slackware packages (and so, simple to install with alien(1) on every package system like rpm or deb)

14 july 98: added a small manpage sfm(1)

12 july 98: added "\n" to stdout after ``choose action'' and ``many actions 2'' (it is to separate for eg the "ls -ld"s)

12 july 98: added "-->ls -ld" and "-->du -sc" to the .sfm file

19 june 98: Alt+W puts the current selected_files in the X selection

19 june 98: when renaming, Ctl+Y inserts the primary X selection.

19 june 98: corrected a bug in the sort by extension

19 june 98: function expandEnvVars is rewritten. Now you can have "$docs2" that is not taken as "${docs}2" if "$docs" exists.

19 june 98: the dir entries are kept in a stack. You can use the arrow keys (up and down) to find the one you want. Press enter to accept. You must use Tab to leave the dir entry.

19 june 98: added a message in mymalloc.c for already freed blocks.

19 june 98: corrected the bug "when an action terminates, the view is updated and the active_file may change."

19 june 98: doing a chdir with the initial directory before calling prog_name so that execing something like "./sfm" works.

16 june 98: sfm 1.4 released

16 june 98: modified action() so that killing action() kills its child. You can now stop a paste (cp, mv) with Ctl+K.

16 june 98: new shortcut for quitting living children in background

16 june 98: you have the ability to kill all the children with Ctl+K

13 june 98: "done ..." messages are now cleanly handled. It will now be easy to propose something else than "an action is in progress" : ask if the action should be killed or should continue in background

13 june 98: in the popup menu, moved "Quit" from the more-menu to the standard one

13 june 98: corrected a bug : using getenv("PWD") is now replaced by getcwd Consequence: under bash, you can exec sfm with no parameter -> it starts with the current directory

12 june 98: better handling of directories and files with not enough rights

11 june 98: when you create new files, the views are now updated

11 june 98: changed the colors to be similar to what you have in a terminal (LS_COLORS)

11 june 98: you can now sort by extension

11 june 98: you can now use many "%s" in the .sfm file, both are replaced

10 june 98: selected files are kept after a simple update (can be nasty)

05 june 98: you can now paste absolute or relative symbolic links (using the popup menu)

05 june 98: added a popup menu (when right-button-press)

03 june 98: added the Mod1-Control-Return shortcut (!). It is a bit like Control-Return, but quite different also. This new one calls only one program with the selected_files as arguments. It's interesting for something like "tar cvfz default.tgz".

03 june 98: file given to progs are now relative instead of being absolute (it is possible because of the chdir done (see below))

03 june 98: after a sfm_doc_set_directory or sfm_doc_up_directory, doing a chdir in the new directory so that programs uses the current sfm directory as their current directory.

03 june 98: added the ability to press return in the dialog window "what program do you want to use ?" instead of having to press the Ok button.

01 june 98: added the possibility to launch a program. It uses the extension if it exists, otherwise it uses the information given by file(1). The informations are stored in a file automatically updated.

27 may 98: after an update, the active file is no more centered if it is already visible.

27 may 98: creation of Changes file


<- back mirrors : chez, linuxbox, geocities

README file

This program is a simple file manager. It's meant to be small and fast and have a lot of shortcuts. You can associate actions with files (using its extension or its type given by file(1)). A popup menu gives you the available commands and shortcuts. You can have multiple views talking between each others. The filenames are colored using the LS_COLORS variable. You can also use it as a directory traveller. It uses the gtk+ library.

You have the ability to not use the mouse at all, using mnemonics and shortcuts. I really think something like kfm and xfm is too slow and not enough shortcut driven. This program is meant to minimize memory consumption and to be very fast.

This is taken from Linux Gazette #30, written by Larry Ayers:

> As the GTK GUI programming toolkit matures more developers have been inspired to use it for the visual presentation of their programs. Pascal Rigaux, a French programmer, has come up with a small file-manager he calls sfm. Sfm isn't quite as simple as the name and initial appearance imply; it has a remarkably full feature-set for such a small program.

> There has been a long succession of X Windows file-managers which use various icons to represent different types of files. This approach can be useful for people accustomed to a Macintosh or Windows environment, where this type of file-manager is common. These icons do have drawbacks, though, as fewer files will fit into a single display window which results in much more scrolling to find a particular file. The impact on system resources is considerable as well, as the X server is called upon to constantly update the display, and memory usage is much greater than what is needed by a text-based manager. In the end it's just a matter of preference.

> Sfm is unusual in that it is an X-only file-manager which is also text-based (FileRunner is another). It also goes against the general trend towards mouse-based applications in that the keyboard interface is well-developed.

> Appearance and Features: The default window size is rather small; my first impression was that this was a trivial application, probably a first GTK programming exercise without much utility. As I explored further (and actually read the README file!) I found that sfm's uncluttered appearance conceals an interesting and useful approach to the perpetual effort to contrive a useful interface to the ls utility. The interesting part is the right-mouse-button menu which offers a plethora of actions which can be performed upon the highlighted file, along with a submenu offering less-used possibilities.

Please send all bug reports by e-mail to: pixel_@geocities.com

sfm is free software. See the file COPYING for copying conditions.

Pixel.

WARNING
I'm not good at all at documenting. Moreover I'm french and my english is, well, not great. Also don't trust this file too much. The only doc up-to-date is the source code.

.sfm FILE
The .sfm is auto-generated and keeps the actions you've choosen associated with a file. It's powerfull. Instead of explaining the capabilities I prefer telling you to look at the .sfm file, it should be explicit enough.

FEATURES
* popup menu giving the commands available (pops when rigth-button is press)
* launching programs from the file using its extension or the information given
by file(1)
* automatic configuration of the correspondance extension-program,
filetype-program
* possibility to have multiple program associated with one file type or
extension (eg: lpr and gv for .ps). There is a default one (it is the first in the configuration file).
* possibility to ignore some extension (eg: all ~ are ignored => .c~ is the same
extension as .c)
* possibility to give a program (eg: gzip) associated with every file. This
program can't be the first program (when you press Return, it's not called) * the directory you're in is displayed
* you can edit the directory displayed
* directories are kept in a stack so that you have a history of the last directories
(use arrow keys up/down to access to a older/newer directory) * directories are listed first
* you can sort by name or by extension
* you can use sfm to change directoy: create an alias that calls
"cd `sfm --cdm`". When you'll quit sfm, your directory will be changed (example of an alias in csh: alias cdm 'cd `sfm --cdm \!*`', or even alias cdm 'cd `sfm --cdm \!* | tail -n1`' that works with multiple views). * file coloring: environment variable LS_COLORS is used to colorate files
* Copy-Paste
* Cut-Paste
* Link-Paste
* Create empty file
* Create directory
* Rename
* Delete
* Searching a file by typing letters
* Pasting a file (or directory) which already exists, paste to another name
ending by -#n. Not clear, well an example is worth thousands of words: select file "aaa", Control-c, and Control-v creates files "aaa-0". It seems to be a problem when wanting to merge directories.

GLOSSARY
* active_file:
* selected_files:
* to_be_paste_files:

SHORTCUTS
* Return: launch the default program associated with the active_file if it
exists. Otherwise prompt for a program to associate the active_file with * Shift-Return: prompt a list of the programs associated with the active_file
(including the programs associated with every file) * Control-Return: launch every selected_files using their default associated
program (if it doesn't exist, the file is just skipped) * Control-Shift-Return: prompt for a program to associate the active_file with
* Mod1-Control-Return: it is a bit like Control-Return, but quite different also. This one calls only one
program with the selected_files as arguments. It's interesting for something like "tar cvfz default.tgz". It prompts a list of the program associated with the active_file * Down: move active_file down, selected_files = active_file
* Up: move active_file up, selected_files = active_file
* Home: active_file = first file, selected_files = active_file
* End: active_file = last file, selected_files = active_file
* Prior: move active_file up one window, selected_files = active_file
* Next: move active_file down one window, selected_files = active_file
* Control-Down: move active_file down, selected_files unchanged
* Control-Up: move active_file up, selected_files unchanged
* Control-Home: active_file = first file, selected_files unchanged
* Control-End: active_file = last file, selected_files unchanged
* Control-Prior: move active_file up one window, selected_files unchanged
* Control-Next: move active_file down one window, selected_files unchanged
* Shift-Down: move active_file down, add active_file to selected_files
* Shift-Up: move active_file up, add active_file to selected_files
* Shift-Home: active_file = first file, from old active_file to active_file are added to selected_files
* Shift-End: active_file = last file, from old active_file to active_file are added to selected_files
* Shift-Prior: move active_file up one window, from old active_file to active_file are added to selected_files
* Shift-Next: move active_file down one window, from old active_file to active_file are added to selected_files
* Control-Shift-Down: cf Shift-Down
* Control-Shift-Up: cf Shift-Up
* Control-Shift-Home: cf Shift-Home
* Control-Shift-End: cf Shift-End
* Control-Shift-Prior: cf Shift-Prior
* Control-Shift-Next: cf Shift-Next
* BackSpace: up_directory
* Delete: delete selected_files
* Tab: give the Dir entry the focus
* Control-d: give the Dir entry the focus
* Control-D: give the Dir entry the focus
* Mod1-d: give the Dir entry the focus
* Mod1-D: give the Dir entry the focus
* F2: rename active_file
* Control-r: rename active_file
* Control-i: invert selected_files
* Control-t: toggle sort type (name, extension)
* Control-k: kill all children (aka all actions)
* F5: update
* Control-l: update
* Left: up_directory
* Right: action
* Control-1: new view #1
* Control-2: new view #2
* Control-3: new view #3
* Control-4: new view #4
* Mod1-1: new view #1
* Mod1-2: new view #2
* Mod1-3: new view #3
* Mod1-4: new view #4
* Control-a: select all
* Control-c: selected_files are put in the to_be_paste_files for copying
* Control-Shift-c: selected_files are added in the to_be_paste_files for copying
* Control-x: selected_files are put in the to_be_paste_files for moving
* Control-Shift-x: selected_files are added in the to_be_paste_files for moving
* Control-s: selected_files are put in the to_be_paste_files for symbolic linking
* Control-Shift-s: selected_files are added in the to_be_paste_files for symbolic linking
* Control-n: create new directory
* Control-Shift-n: create new empty file
* Control-v: paste the to_be_paste_files
* Control-q: quit
* Mod1-q: quit
* Control-Shift-q: quit living children in background
* Mod1-Shift-q: quit living children in background
* Control-w: put the selected_files in the X selection
* Mod1-w: put the selected_files in the X selection
* any-key with no modifiers (except Shift): active_file change to the file starting with

RENAMING ACTION
* Return: do it (the renaming)
* Control-y: yank the primary X selection
While renaming, a lot of things cancels the renaming.


<- back mirrors : chez, linuxbox, geocities

TODO file

TODOs
* The socket name should vary (eg: two users on the same computer)
* Shortcuts description in the README file are false (eg: S+Home)
* Code clean-up
* Look at the way memory is allocated
* Correct bugs
* Add comments
* Documentation
* Customizability (for shortcuts, default creation file names, colors used)
* Update to_be_paste_files after a paste
* Just pasted files are put in selected_files
* Automatically renaming pasted directory is a problem when wanting to merge
directories
* Mod1-Return displays information on the active_file or maybe
selected_files. The informations could be editable (modes, owner, size) * Indicate what a symbolic link is pointing to (= information about the link)

MAYBEs (one day, if some people really think it's interesting (as I don't think so)) * Create a view containing the to_be_paste_files so that it can be edited (there
should be the name and the type of paste)
* Updating the views could be more intelligently done: test if the current
directory is in the modified directories
* The statusbar at the bottom could be left justified
* Use autoconf
* Buttons
* Add horizontal scroll. It will conflict with Left, Right, Home and End shortcuts.
* Multi-column (much trouble)
* Drag & drop
* Gnome interconnection. I really don't know much about the possibilities...
* Program uses cp(1) and mv(1). When cp(1) fails it doesn't stop after one
permission denied... mv(1) can fail on fats (because chown fails). I nevertheless think the program should rely on cp(1) and mv(1). So... * The list is sorted. It could be interesting not to sort it, in certain cases
(eg: rename)
* The shortcuts indicated in the popup menu are tricky to display
right-justified. It seems nothing easy can be done using gtk+. For the moment, the size of the string is calculated (with gdk_string_width) and spaces are added between the label and the shortcut. The result is, well, not very nice...


<- back mirrors : chez, linuxbox, geocities

BUGS file

* doing shift-pagedown then shift-pageup should do nothing (increase then decrease the selected_files)
* after a delete, the focus is not given back to sfm
* on a directory symlink, ls -ld says it is directory as the action
is called with a '/' following the directory symlink * sometimes, there are actions that are leaved alone as ``zombies''
* problem with cdm when the directory contains spaces (eg: "/tmp/the dir/")
* no protection when doing a long action (eg: you can enter a directory you are
deleting or moving). Can cause a sigsegv.
* using views on different pages of a virtual desktop (virtual window managers)
causes an error from the X server (like BadMatch). * (seems to be fixed) sometimes, you get "Xlib: unexpected async reply (sequence
0x3724)!". I don't know why. I thougth it was using signal(2) to handle the signals I use, and to use gtk functions in this handlers. That's why I replaced these handlers by a gtk_signal_emit to the real handler. It seems better. It also seems not enough... As it's hard to make it bug, I'll wait until I can make it bug repeatedly.
* you can't scroll horizontally so you can't see the whole file names
(workaround: enlarge sfm or rename the file)


<- back mirrors : chez, linuxbox, geocities

.sfm-example file

English text==>xterm -e less
C program text==>xterm -e less
ASCII text==>xterm -e less
International language text==>xterm -e less -r
empty==>true
GIF image data, version 89a, 201 x 285,==>xview
PostScript document text conforming at level 2.0==>gv ELF 32-bit LSB executable, Intel 80386, version 1, dynamically linked, stripped==>xterm -e %s Makefile-->xterm -e sh -c 'make -f %s | less'
.bat-->xterm -e less
.so-->nm
.a-->nm
.o-->nm
.class-->java
.class-->appletviewer
.tar-->xterm -e sh -c 'tar tf %s | less'
.tar-->tar xf %s
.tgz-->xterm -e sh -c 'gunzip -c %s | tar tf - | less' .tgz-->gunzip -c %s | tar xf -
.tar.gz-->xterm -e sh -c 'gunzip -c %s | tar tf - | less' .tar.gz-->gunzip -c %s | tar xf -
.gz-->gunzip
.bz2-->bunzip2
.z-->uncompress
.zip-->unzip -tl
.jar-->unzip -tl
.rpm-->rpm -qip
.bmp-->xview
.gif-->xview
.jpeg-->xview
.jpg-->xview
.pbm-->xview
.pcx-->xview
.pgm-->xview
.ppm-->xview
.ras-->xview
.rf-->xview
.tga-->xview
.tif-->xview
.tiff-->xview
.xbm-->xview
.xpm-->xview
.au-->play
.mid-->tracker
.mod-->tracker
.s3m-->tracker
.wav-->wavplay
.mp3-->mpg123
.mp2-->mpg123
.mov-->xanim
.mpg-->xanim
.mpeg-->xanim
.avi-->xanim
.m4-->m4
.c-->gcc -c
.C-->g++ -c
.cc-->g++ -c
.cpp-->g++ -c
.c++-->g++ -c
.csh-->csh
.java-->javac
.pas-->p2c
.ml-->camlc
.pl-->perl
.htm-->xterm -e lynx
.html-->xterm -e lynx
.rtf-->richtext
.txt-->xterm -e less
.doc-->xterm -e less
.lyx-->lyx
.tex-->xterm -e less
.tex-->latex
.dvi-->xdvi
.dvi-->dvips %s -o
.ps-->gv
.ps-->lpr
.pdf-->xpdf
.pdf-->acroread
.pdf-->gv
.tgz-->gunzip
.c-->xterm -e less
.gif-->xterm -e less
.gif-->gimp
.o-->gcc %s
.out-->sh -c
.eps-->gv
.pic-->xview
.pl-->emacs
.pl-->xemacs
.zip-->unzip -l
.zip-->unzip
.xpm-->xv
.out-->
~-->
.bak-->
.old-->
,v-->
-->ls -ld
-->du -sc
-->gzip -9
-->bzip2 -9
-->emacsclient --no-wait
-->xterm -e less
-->tar cvfz default.tgz

Pixel

PS: l'image de fond a été faite avec gimp.

1