368 lines
15 KiB
HTML
368 lines
15 KiB
HTML
<!--startcut ==========================================================-->
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<title>Dotfile Generator Issue 17</title>
|
|
</HEAD>
|
|
<body BGCOLOR="#FFFFFF">
|
|
<!--endcut ============================================================-->
|
|
|
|
<H4>
|
|
"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
|
</H4>
|
|
|
|
<P> <HR> <P>
|
|
<!--===================================================================-->
|
|
|
|
<center>
|
|
<center><img width=446 height=113 src="./gx/pedersen/logo.gif"></center>
|
|
<H4>By Jesper Pedersen,
|
|
<a href="mailto:admin@imada.ou.dk">admin@imada.ou.dk</a></H4>
|
|
</center>
|
|
<P> <HR> <P>
|
|
|
|
|
|
|
|
<P> In this article I will describe a configuration tool called The Dotfile
|
|
Generator (TDG for short). TDG is a configuration tool, which configures
|
|
programs, using X11 widgets like check boxes, entries, pull-down menus etc.<p>
|
|
|
|
For TDG to configure a given program a module must be made for it. At the
|
|
moment modules exist for the following programs: Bash, Fvwm1, Fvwm2, Emacs,
|
|
Tcsh, Rtin and Elm.<p>
|
|
|
|
The article will describe common use of TDG, so if you do not have it yet,
|
|
it might be a good idea to <a
|
|
href="ftp://ftp.imada.ou.dk/pub/dotfile/dotfile.tar.gz">download
|
|
it</a> (It's free!) You may also go to <a
|
|
href="http://www.imada.ou.dk/~blackie/dotfile/">the home page of the
|
|
Dotfile Generator</a> for further information.
|
|
|
|
|
|
|
|
|
|
<p><hr><center><h1>Intro</h1></center>
|
|
The UNIX system, was developed many years ago, long before
|
|
graphical user interfaces became commonplace. This means that most of the applications
|
|
today work fine without a graphical user interface. Examples of this are
|
|
editors and shells.<p>
|
|
|
|
A basic concept in UNIX is that the programs are very configurable. Here is
|
|
an example from Emacs, which shows this:<p>
|
|
|
|
<blockquote>
|
|
<i>What should be done if the user asks to go to the next line at the of</i>
|
|
a file?<br>
|
|
There are two logical
|
|
possibilities: <ol>
|
|
<li> Insert a blank line, and move to it.
|
|
<li> Beep, to tell the user that there is no next line.
|
|
</ol>
|
|
|
|
Instead of implementing only one of the solution the people behind Emacs,
|
|
have chosen to implement both, and let you decide which one you prefer.
|
|
</blockquote>
|
|
|
|
Since the program works without a GUI, the standard method for
|
|
configuring such options is to use a <i>dot-file</i>. In this file, you
|
|
may <i>program</i>, which method you will use.<p>
|
|
|
|
This solution, however, requires that the user has to learn the programming
|
|
language used in the dot-file, and has to read lots of documentation to
|
|
find out which configurations can be made. This task may be difficult and
|
|
tedious, and for that reason many users often choose to use the default
|
|
configuration of the program.<p>
|
|
|
|
If you take a look at some dot-files, you may find
|
|
that most of the configurations can be described by the following items:
|
|
<ul>
|
|
<li> Configurations with two possibilities (like above)
|
|
<li> Configuration, where the program wishes to know a number or text.
|
|
Examples of this could be questions like: <i>how many times should
|
|
one press CTRL-d to quit</i>, and <i>email address to use in
|
|
reply-to field</i>.
|
|
<li> Configuration, where the user may choose an option from a list, eg:<br>
|
|
<i>which editor would you like to use: emacs, jed, vi or vim</i>
|
|
</ul>
|
|
|
|
The configurations above may easily be done with a GUI, with the following
|
|
widgets in order: A check box, an entry and a pull down menu.
|
|
|
|
This is exactly what is done in TDG.
|
|
|
|
|
|
|
|
<p><hr><center><h1>The basic concept of TDG</h1></center>
|
|
|
|
TDG is a tool, which configures other programs (eg. emacs,bash and fvwm)
|
|
with widgets as those described above, and many more. The widgets are
|
|
placed in groups, which makes it easy to find the correct configuration
|
|
without having seen it before. And most important of all, help is located
|
|
at the configuration of each option, instead of in a manual far away. To get
|
|
help, you just press the right mouse button on the widget, which contains
|
|
the configuration you want to know more about!<p>
|
|
|
|
When you start TDG, you will be offered a list of standard configurations,
|
|
where you may pick one to start out with. This may be convenient, if you do
|
|
not have a dot-file for the given program, or if you would like to try a
|
|
new configuration. If on the other hand, you already have a dot-file, which
|
|
you would like to put the finishing touches to, you may read this file into
|
|
TDG. Note, however, that it is not all modules, which have the capability
|
|
to read the dot-file (the fvwm2, rtin and elm modules have, the other
|
|
modules do not, since it would be to complicated to create such a
|
|
parser.)<p>
|
|
|
|
When you have selected a start-up configuration, the menu-window will be
|
|
displayed (see figure 1). In this window, you can travel through the
|
|
configuration pages, just like a directory structure. If you select a
|
|
page, a new window will be displayed, with the configuration for this page
|
|
(see figure 2). This window will be reused for all the configuration pages,
|
|
ie. only one configuration page is visible at a time, so you do not have
|
|
to destroy the window yourself.<p>
|
|
|
|
<table CELLSPACING=1 CELLPADDING=4 cols=2 width=100%>
|
|
<tr>
|
|
<td align=top>
|
|
<center><img width=294 height=196 src="./gx/pedersen/menu_window.jpg"><p>Figure 1</center>
|
|
|
|
<td align=top>
|
|
<center><img width=399 height=203 src="./gx/pedersen/config_page.jpg"><p>Figure 2</center>
|
|
</table>
|
|
|
|
In region 1, the actual configuration is located. Region 2 is the help
|
|
region. In this region help for the whole page is shown, when the window is
|
|
displayed. It's also here, help for the individual configuration is
|
|
shown, when you press the right mouse button on one of the widgets.<p>
|
|
|
|
In region 3, information is shown on what will be generated. You have
|
|
three possibilities:
|
|
<ol>
|
|
<li> You may generate all pages. This is the most natural thing to do,
|
|
when you just want a configuration for a given program.
|
|
|
|
<li> You may generate just the page shown. This is useful if you are
|
|
plying around with TDG to see what will be generated for the
|
|
different configurations.
|
|
|
|
<li> Finally you may tell TDG, to just generate some of the pages, which
|
|
is done with radio buttons in this region.
|
|
</ol>
|
|
|
|
In the <tt>Setup</tt>-><tt>Options</tt> menu, you may select which of the
|
|
three methods above will be used.<p>
|
|
|
|
When you have done all the configurations, you have to tell TDG which file
|
|
you wish to generate. This is done from the Options menu
|
|
(<tt>Setup</tt>-><tt>Options</tt>). And now it's time to create the actual
|
|
dot-file, which is done by selecting <tt>Generate</tt> in the <tt>File</tt>
|
|
menu.<p>
|
|
|
|
Once you have generated the dot-file, you may find that you would like some
|
|
of the configuration to be different. You could now go to the configuration
|
|
page in question, change your configuration, and then generate once again. If,
|
|
however, you are testing several different options for a single
|
|
configuration (ie. several items from a pull-down menu) you may find it
|
|
cumbersome to generate the whole module over and over again. In this
|
|
situation, you may chose <tt>Regenerate this page</tt> in the <tt>File</tt>
|
|
menu. Note, however, that if some part of the configurations on the page effects
|
|
other pages, these will not be generated, so in these situation
|
|
you have to generate the whole module.<p>
|
|
|
|
To see how to use the generated dot-file, please go to the <tt>Help</tt>
|
|
menu, and select the <tt>How to use the output</tt> item.
|
|
|
|
|
|
|
|
|
|
<p><hr><center><h1>The configuration widgets</h1></center>
|
|
|
|
TDG uses a lot of widgets to let you configure the different options. Some
|
|
of them are well known from other applications and include: check boxes,
|
|
radio buttons, pull-down menus, entries, text boxes (for multi-line text),
|
|
directory and file browsers. Others, however, are specifically designed for use
|
|
in TDG, and they will be described in the following.
|
|
|
|
|
|
<p><center><h2>The ExtEntry widget</h2></center>
|
|
|
|
The ExtEntry is a container, which repeats its elements, just like a
|
|
list-box repeat labels. A number of the elements in the ExtEntry may be
|
|
visible on the screen at a time. The elements in the ExtEntry may be any of
|
|
the widgets from TDG (ie. check boxes, pull-down menus and even other
|
|
ExtEntries.) One element in an ExtEntry is called a tuple.
|
|
|
|
In Figure 3, you can see an ExtEntry from the Tcsh module.<p>
|
|
|
|
|
|
<center>
|
|
<img width=600 height=105 src="./gx/pedersen/extentry1.jpg"><br>
|
|
Figure 3
|
|
</center><p>
|
|
|
|
This ExtEntry has three visible tuples, though only two of them contain
|
|
values (you can see, that the third one is grayed out). To add a new tuple
|
|
to the ExtEntry, you have to press the button in the lower right corner,
|
|
just below the scroll bar. If the ExtEntry contains more tuples than can be
|
|
shown in it, you may scroll to the other tuples with the scroll bar.<p>
|
|
|
|
If you press the left mouse button on one of the scissors, a menu
|
|
with four elements will be displayed. These elements are used to cut, copy
|
|
and paste tuples within the ExtEntry.<p>
|
|
|
|
If the tuples get very large, only one of them may be shown on the screen
|
|
at a time. An example of that is seen in figure 4.<p>
|
|
|
|
When the tuples contain many widgets, scrolling the ExtEntry becomes
|
|
slow. In these cases, the ExtEntry may have a quick index. In figure 4, you
|
|
can see the quick index at the top of the ExtEntry (it's the button labeled
|
|
Idx.) When this quick index is invoked, a pull-down menu is display with
|
|
the values of the element associated with the quick index. This makes it much
|
|
easier to scroll the ExtEntries.<p>
|
|
|
|
|
|
<table CELLSPACING=1 CELLPADDING=4 cols=2 width=100%>
|
|
<tr>
|
|
<td align=top>
|
|
<center><img width=310 height=272 src="./gx/pedersen/extentry2.jpg"><p>Figure 4</center>
|
|
<td align=top>
|
|
<center><img width=360 height=274 src="./gx/pedersen/prompt.jpg"><p>Figure 5</center>
|
|
</table>
|
|
|
|
|
|
|
|
<p><center><h2>The FillOut widget</h2></center>
|
|
|
|
Every shell has a configuration option called <tt>Prompt</tt>. This option
|
|
is some text, which will be printed, when the shell is ready to execute a
|
|
new command. In this text special tokens may be inserted, and when the
|
|
prompt is printed, these tokens will be replaced, with some information from
|
|
the shell. Eg. in Bash <tt>\w</tt> will be expanded to the current working
|
|
directory.<p>
|
|
|
|
In TDG, a special widget has been created called a <tt>FillOut</tt>, which
|
|
does configurations like the above. In Figure 5, you can see a FillOut
|
|
widget from the Bash module. At the top of the widget there is an entry,
|
|
where you can type ordinary text. Below it, the tokens are placed. If you
|
|
select one of the tokens, it is inserted in the entry at the point of the
|
|
cursor. Some of the tokens may even have some additional
|
|
configurations. Eg. the token <tt>Current working directory</tt> has two
|
|
possible options: <tt>Full directory</tt>, and <tt>only the last part</tt>. When tokens with
|
|
additional configurations are selected, a window will be displayed, where
|
|
these configurations can be done. If you wish to change such a configuration,
|
|
press the left mouse button on the token in the entry.
|
|
|
|
|
|
|
|
|
|
<p><center><h2>The Command widgets</h2></center>
|
|
|
|
TDG can be extended by the module programmer through the Command
|
|
widget. This makes it possible to configure specific options with widgets
|
|
they have developed themseves. At the moment three such widgets exist: The
|
|
directory/file browser, the color widget and the font widget.<p>
|
|
|
|
The widgets will appear as a button within TDG, and when the button is
|
|
pressed a new window will be displayed, where the actual configuration is done.
|
|
|
|
|
|
|
|
<p><hr><center><h1>Save, Export and Reload</h1></center>
|
|
When you have configured the different options in TDG, you may wish to
|
|
leave it, and come back later, and change some of the configurations. When
|
|
you leave TDG, you may save your changes, which you do from the
|
|
<tt>File</tt> menu.<p>
|
|
|
|
Next time you enter TDG, your saved file will be one of the the files you
|
|
will be offered as a start-up configuration.<p>
|
|
|
|
One important point you have to note is that this <tt>save file</tt> is an
|
|
internal dump of the state of TDG. This means that this file dependson
|
|
the version of TDG and the module. This means that if you wish to send a
|
|
given configuration to another person, this format is not appropriate. A
|
|
version independent format exists, which is called the <i>export
|
|
format</i>. To create such a file, you have to select <tt>Export</tt>
|
|
instead of <tt>Save</tt> in the <tt>File</tt> menu.<p>
|
|
|
|
Sometimes you may wish to restore the configuration on a single page, to its
|
|
value as it was before you started playing around with it, or you may wish
|
|
to merge another person's configuration with your own. This is done by selecting
|
|
<tt>Reload</tt> in the <tt>File</tt> menu. To tell TDG that you only want
|
|
to reload some of the pages, you have to select the <tt>Detail</tt> button
|
|
in the load window. This will bring up a window, where you can select which
|
|
configuration pages, you wish to reload. Here you can also tell it how you
|
|
want the pages to be reloaded. You have two possibilities:
|
|
<dl>
|
|
<dt> Overwrite
|
|
<dd> The pages you are loading, will totally overwrite the
|
|
contents of the file
|
|
<dt> Merge
|
|
<dd> Tuples in the ExtEntries will be appended to those which already
|
|
exist in the module. Other configurations will be ignored in the file.
|
|
</dl>
|
|
|
|
Here's another difference between the save-files and the export-files: You
|
|
cannot merge with save-files. This means that if you have a save-file,
|
|
which you wish to merge with, you first have to load it, export it, and
|
|
then you can merge with it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<p><hr><center><h1>The End</h1></center>
|
|
Additional information
|
|
can be found on <a href="http://www.imada.ou.dk/~blackie/dotfile/">the home page
|
|
</a> for TDG.<p>
|
|
|
|
It's always a good idea to have a bookmark on this page, as work is
|
|
currently in progress on new modules.
|
|
|
|
<dl>
|
|
<dt> procmail
|
|
<dd> I have finished a module on procmail, a mail
|
|
filter, which can sort your incoming mail.<p>
|
|
|
|
<dt> firewall configuration (ipfwadm)
|
|
<dd> John D. Hardin (<a
|
|
href="mailto:jhardin@wolfenet.com">jhardin@wolfenet.com</a>) is
|
|
working on a module for configuring the fire walling and IP
|
|
Masquerading setup for standalone systems connected to the Internet via
|
|
dialup. He may, however, expand it to more general fire walling.
|
|
</dl>
|
|
|
|
If you have some spare time, I would very much like to encourage you to
|
|
develop a module for your favorite program. On the home page of TDG, there
|
|
is a link to a document, which describe how to create a module for TDG. <a
|
|
href="mailto:blackie@imada.ou.dk">Send me a letter</a>, and I will be happy
|
|
to help you get started with it.
|
|
|
|
<hr>
|
|
<address><a href="http://www.imada.ou.dk/~blackie/">Jesper Kjær
|
|
Pedersen</a> <blackie@imada.ou.dk></address>
|
|
<!-- hhmts start -->
|
|
Last modified: Wed Feb 5 15:59:35 1997
|
|
<!-- hhmts end -->
|
|
|
|
|
|
<!--===================================================================-->
|
|
<P> <hr> <P>
|
|
<center><H5>Copyright © 1997, Jesper Pedersen <BR>
|
|
Published in Issue 17 of the Linux Gazette, May 1997</H5></center>
|
|
|
|
<!--===================================================================-->
|
|
<P> <hr> <P>
|
|
<A HREF="./index.html"><IMG ALIGN=BOTTOM SRC="../gx/indexnew.gif"
|
|
ALT="[ TABLE OF CONTENTS ]"></A>
|
|
<A HREF="../index.html"><IMG ALIGN=BOTTOM SRC="../gx/homenew.gif"
|
|
ALT="[ FRONT PAGE ]"></A>
|
|
<A HREF="./clueless.html"><IMG SRC="../gx/back2.gif"
|
|
ALT=" Back "></A>
|
|
<A HREF="./gm.html"><IMG SRC="../gx/fwd.gif" ALT=" Next "></A>
|
|
<P> <hr> <P>
|
|
<!--startcut ==========================================================-->
|
|
</BODY>
|
|
</HTML>
|
|
<!--endcut ============================================================-->
|