
Small tips and tricks for more effective use of FileRunner
-------------------------------------------------------------
-------------------------------------------------------------

Table of Contents


Check boxes for configure option:

Config files:

Dockable Menus:

Using Firefox to display .html files:

How to handle file names with blanks in the view (and other) config text:

Right justifying file size in the list boxes:

Grouping the size in groups of three (i.e. 123,456,789):

Puting a space before the file name in the directory list boxes:

Man files and filerunner:

A button to clone a root version of fr:

Filerunner library of tcl/tk routines for your use:

-------------------------------------------------------------
Check boxes for configure option:

Several of the 'check' options at the top of the 'Configuration' menu
can also have check boxes at the top of the filerunner window. Find
'Fast Checkboxes' under 'Miscellaneous' in the 'Configuration Browser'.
This is a great help if you want the 'balloon help' only some of the
time, for exammple, or if sometimes you want to see hidden files but not
always. 
-------------------------------------------------------------
Config files:

There are two config files that filerunner visits on start up. The user
  config file is private to the user and is is located here:

  ~/.fr/cmds

  The location of the system wide 'config' file varies depending on how
  filerunner is installed.  (If installed by a user, it is really not
  system wide.)  In either case it is found by filerunner (and may be
  found by you) by inspecting the file 'config' in the directory that
  contains the filerunner code. The easy way to find this is to open a
  command window at the bottom of filerunner and type:

  %set glob(lib_fr)
  
  This file is built by the INSTALL script and informs filerunner of the
  location of the 'doc' directory and the system wide config file which
  is usually called 'filerunnerrc'.


-------------------------------------------------------------
Dockable Menus:

It is easy to create a menu window that you can move to any location on
your desk top.  Here is how:

First select an event to bind the menu to.  You want an event you hardly
ever use. For this example I use <Shift-1>.  That is mouse 1 with the
shift key.  (possible modifiers may be found here:
https://www.tcl.tk/man/tcl8.6/TkCmd/bind.htm

Now open the 'Configuration Browser' 
(Configuration -> Edit Configuration).
Click on 'Mouse Bindings & menus' near the top left.
Scroll down in the right panel to the set of 'set config(bind,...
lines.  Here you want to enter the event and the menu name, for this
example I use 'mymenu'.

set config(bind,Shift-1) DoMenu,mymenu

Now scrolling down in the right panel to the menu configuration where
you see 'set config(menu,... ' lines.

This is where the menu is defined, e.g.:

set config(menu,mymenu) {
    Copy
    CopyAs
    Delete
    Move
    Rename
    MkDir
    S-Link
    S-LnAs
    Chmod
    View
    Edit
    Q-Edit
    Arc
    UnArc
    UnPack
    ForEach
    Print
 }
Now click 'OK' at the bottom of the window.  
When you do a 'shift mouse 1' the menu will appear.  To make it dockable
    click on the dotted line at the top.  Now you may move the menu
    anywhere you want (i.e. dock it).


-------------------------------------------------------------
Using Firefox to display .html files:

It is convenient to view .html files by using the View command. 

This just works by putting the following in your
config(view,extensions) variable:

  { {firefox %s}
    {*.html} }

If you (like me) like to run filerunner as root and want to look at files with
firefox (or other programs that don't want to be called by root) you can put
a helper file (I call it myfirefox) that looks like this:

#!/bin/bash
#
# if we are root, pass the request to the local account
#
if [ `whoami` = "root" ] ; then 
#    echo "trying su --session-command=myfirefox $@ YOURNAME"
    su --session-command="firefox $@" YOURNAME
else
#    echo "trying firefox $@"
    firefox "$@"
fi

Put this in your ~/bin directory and then change the config(view,extensions)
variable to call 'myfirefox' (or what ever you name it).

-------------------------------------------------------------
How to handle file names with blanks in the view (and other) config text:

The configuration file can contain file & path names that are needed to 
reference helper tasks (editor, view tasks, etc).  If these paths contain blanks
you must tell filerunner about them by using braces (for example for firefox):

{{ {/home/john jones/bin/myfirefox} %s}
   {*.html} }

See also the note on 'config(space)' in the configure file.

-------------------------------------------------------------
Right justifying file size in the list boxes:

The directory list box format is controlled by 'script' in the configure
file. Open the configuration browser 
(Configuration -> Edit Configuration)
and, under appearance select 'ListBoxScripts'. Each fields format is set
here.  There is no true right justify in tcl but you can get close by
using format %Ns where N is the number of digits you expect in your
number.  If the number contains more than N digits the format command
will extend the field to the right so the result is right justified
until you encounter a number too large for the field.  At the moment I
am using: 

    {links {format %3s $nlink}}
    {size  {format %6s $size}}

for the links field and the file size field.

-------------------------------------------------------------
Grouping the size in groups of three (i.e. 123,456,789):

This makes it much easier to read large file sizes.  We use the same 
idea as above, but it is a little more complex:

     {size {format %8s [string reverse [regsub -all {.{3}(?!$)} [string reverse $size] {&,}]]}}

The above will put commas between each group.  If you prefer a different character
(e.g. ".") just change the comma after the "&" above to your prefered character.

-------------------------------------------------------------
Puting a space before the file name in the directory list boxes:

First read the above "Right justifying file size in the list boxes."
Using the same trick, use (note the space in front of the %):

    {file  {format " %s" $ffile}}

for the file entry.

-------------------------------------------------------------
Man files and filerunner:

I use the following view extension for man files:
  { {man   {%s} | ul -t dumb}
 {*.1m.gz *.1.gz *.2.gz *.3.gz *.3pm.gz *.3ssl.gz *.3t.gz *.3thr.gz *.3x.gz *.4.gz *.5.gz *.6.gz *.6x.gz *.7.gz *.8.gz *.9.gz *.n.gz *.1 *.1m *.2 *.3 *.3t *.3thr *.3x *.4 *.5 *.6 *.6x *.7 *.8 *.9 *.n *.1x *.2x *.3x *.4x *.5x *.6x *.7x *.8x *.9x *.1x.gz *.2x.gz *.3x.gz *.4x.gz *.5x.gz *.6x.gz *.7x.gz *.8x.gz *.9x.gz}
   -viewtext }

Problem is that man seems to want to come up with different line lengths
and thus poor formatting.  To fix this I put this: 

global env
set env(MANWIDTH) 80

in either the local or the system wide 'config' file.  This sets the
environment variable MANWIDTH which man uses to set its line length.
This file is 'source'ed each time filerunner starts so any program run
by file runner will see any environment variables set here.  This does
not seem to work on Windows systems, however. (See the tip on config
files above for the location of the config files.)

* The location of the 'config' file varies depending on how filerunner
  is installed.  If it is a system install (i.e. by root) the config
  file will most likely be /usr/local/config/

-------------------------------------------------------------
A button to clone a root version of fr:

First, if you have been on Linux or Unix for any time at all you will have,
in your ~/bin directory, a program that runs a program as root.  In mine, it
is called "doi".  It does not run the program as full root, but has the setuid
bit set: 
         ~/bin/doi rwSr-xr-s  root/root

Given that you have such a program, here is how to create a center button
called "root fr" which will run fr in full root mode (not setuid mode).
First add the following lines to the ~/.fr/cmd file (don't have one? then
this is the whole file):

set config(usercommands) {
    { {root fr} Doroot {Run filerunner as root}}
}
proc Doroot {args} {CmdRunCmd 0 {root fr}}

Note that if you already have a ~/.fr/cmd file, you may already have a 
set config(usercommands) entry here.  In that case, just add the line:

    { {root fr} Doroot {Run filerunner as root}}

some where in that list of user commands.  What this does is define a user
command with a display name (what will be on the button) of "root fr" that 
runs the command "Doroot" and has the balloon help message of:

Run filerunner as root

The proc line defines the command "Doroot" which, in turn runs "CmdRunCmd" 
passing it 0 and "root fr".

In the configure file section "RunList" we now need to tell the "CmdRunCmd"
what to do with this.  Here is the entry we need to add to the end of the 
set config(runlist) entry:

   {{{root fr} {doi su root -c [list fr %s]}}
        { }
        fullname
        async}

(This will be followed by the closing "}" to complete the set config(runlist)
command.)

This tells CmdRunCmd to execute:

 "doi su root -c fr <parm>"

The doi command we covered above.  By using it to run "su" we get full root
mode and do not have to supply a password (because of the doi).  The -c says
to su to just run a single command which is fr.  <parm> will be the selected
directory.  Note you must select a directory prior to clicking on the 
"root fr" button.  If your "doi" program has another name, just change the
above "doi" to match.

-------------------------------------------------------------
Filerunner library of tcl/tk routines for your use:

The following files/routines are tcl/tk code that is used in filerunner
and are written in a general use way so that they may be used in any
tcl/tk script (feel free to use in your code).  These routines have
comments in them explaining every thing (I hope) you need to know to use 
them: 

FontControl.tcl      Puts up a window and displays available fonts.
balloon.tcl          Puts up balloon (or tool tip) windows.
centerWin.tcl        Centers a window in another (master) window.
colorList.tcl        Returns a list of all the color names and RGB values.
entrydialog.tcl      Manages an entry dialog window.
frcolor.tcl          Puts up and manages the color chooser window(s).
frputs.tcl           Used to output debug messages to stdout.
patternListSearch.tcl Used to search a list given multiple patterns
replacetearoff.tcl   Builds a substitute tear-off menu window.
spell_check.tcl	     Implements spell check in a text window.
smart_dialog.tcl     A VERY smart dialog window.
textSearch.tcl       Manages searching of text windows (i.e. View windows).

-------------------------------------------------------------
If you have a good tip to share with other FileRunner users, please send
it to the author. 

















































































































































