The Dotfile Generator

by Jesper K. Pedersen

The Dotfile Generator, TDG, is a configuration tool that configures programs using X11 widgets like check boxes, entries, pull-down menus, etc. In order for TDG to configure a given program, a module must be built for it. At the moment modules exist for the following programs: bash, fvwm1, fvwm2, emacs, tcsh, rtin and elm.

TDG is freely available and can be downloaded from The home page of the Dotfile Generator is at


The Unix system was developed many years ago, long before graphical user interfaces became commonplace, so that most of the applications today work fine without a graphical user interface. Examples of these applications are editors and shells.

A basic concept in Unix is that the programs are very configurable. For example, in Emacs if the user asks to go to the next line after the end of a file, there are two logical ways for Emacs to handle this situation:

  1. Insert a blank line, and move to it.

  2. Beep, to tell the user that there is no next line.

Instead of implementing only one of the solutions, the people behind Emacs chose to implement both, and let you decide which one you prefer. Since the program works without a GUI, the standard method for configuring such options is to use a dot-file. In this file, you can program the method emacs will use.

This solution requires that the user learn the programming language used in the dot file and read lots of documentation to discover the available configurations. This task can be difficult and tedious, and for that reason many users choose to use the default configuration of the program.

If you take a look at some dot files, you may find that most of the configurations can be described by the following items:

  • Configurations with two possibilities (like above)

  • Configuration where the program wishes to know a number or text. Examples of this could be questions like: “How many times should one press ctrl-d to quit?”, and “e-mail address to use in the Reply-to field?”.

  • Configuration where the user may choose an option from a list, e.g., “Which editor would you like to use: emacs, jed, vi or vim?”

The configurations above can be easily done with a GUI using the following widgets in order: a check box, an entry and a pull down menu. This is exactly the method used in TDG.

The Basic Concept of TDG

TDG is a tool which configures other programs (e.g., Emacs, bash and fvwm) with widgets like those described above and many more. The widgets are placed in groups to make 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 that contains the configuration you wish to know more about.

When you start TDG you are offered a list of standard configurations from which you pick one to use as a starting point. This is 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 that you would like to put the finishing touches on, you can read this file into TDG. Note, however, that not all modules have the capability to read the dot-file (the fvwm2, rtin and elm modules have, the other modules do not, since it is complicated to create such a parser.)

Figure 2. TDG Menu Window

When you have selected a start-up configuration, the menu window is displayed (see Figure 2). In this window, you can travel through the configuration pages in the same way you would through a directory structure. If you select a page, a new window is displayed showing the configuration for this page (see Figure 3). This window is reused for all the configuration pages, i.e., only one configuration page is visible at a time, so you do not have to destroy the window yourself.

Figure 3. Configuration Page

The actual configuration is located in region 1 of Figure 3. Region 2 is the help region, and it is in this region that help for the whole page is shown when requested. Help for the individual configuration is also shown here, when the right mouse button is clicked on one of the widgets. In region 3, information is shown on what will be generated. There are three possibilities:

  1. You can generate all pages. This is the most natural thing to do, when you want a configuration for a given program.

  2. You can generate just the page shown. This is useful if you are playing around with TDG to see what will be generated for the different configurations.

  3. Finally, you can tell TDG to generate specific pages using the radio buttons in this region.

In the Setup-Options menu, you can select which of the above three methods to use.

When the configurations are complete, you must tell TDG which file you wish to generate from the Options menu (Setup->Options). Now, it's time to create the actual dot-file by selecting Generate in the File menu.

Once you have generated the dot-file, you may decide to change some of the configuration. If so, go to the configuration page in question, change your configuration and regenerate. If, however, you are testing several different options for a single configuration (i.e., 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 can chose Regenerate this page in the File menu. Note that if some part of the configurations on the page affects other pages, these other pages will not be generated unless you regenerate the whole module.

To see how to use the generated dot-file, go to the Help menu, and select “How to use the output”.

The Configuration Widgets

TDG uses a lot of widgets for configuration of 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.

The ExtEntry Widget

The ExtEntry is a container that repeats its elements, just as a list box repeats labels. A number of the elements in the ExtEntry may be visible on the screen at one time. The elements in the ExtEntry can be any of the widgets from TDG. An element in an ExtEntry is called a tuple. In Figure 4, you can see an ExtEntry from the tcsh module.

Figure 4. ExtEntry for tcsh

This ExtEntry has three visible tuples, although only two of them contain values (as you can see, the third one is grayed out). To add a new tuple to the ExtEntry, press the button in the lower right corner, just below the scroll bar. If the ExtEntry contains more tuples than can be shown in the window, you can scroll to the end of the tuple list using the scroll bar.

When the left mouse button is clicked on one of the scissors, a menu with four elements is displayed. These elements are used to cut, copy and paste tuples within the ExtEntry.

Figure 5. ExtEntry Display of Large tuple

If the tuples get very large, only one of them can be displayed on the screen at a time (see Figure 5). When the tuples contain many widgets, scrolling the ExtEntry becomes slow. In these cases, the ExtEntry may have a quick index. In Figure 5, 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 displayed with the values of the element associated with the quick index. This makes it easier to scroll ExtEntries.

The FillOut Widget

Every shell has a configuration option called Prompt, a text string that is printed when the shell is ready to execute a new command. Special tokens can be inserted in this text, and when the prompt is printed, these tokens are replaced with information from the shell. For example, in bash the token \w is expanded to the current working directory.

Figure 6. FillOut Widget

In TDG, a special widget called FillOut has been created to do configurations like the one above. In Figure 6, you can see a FillOut widget from the bash module. At the top of the widget there is an entry in which you can type ordinary text. The tokens are placed below it. 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. For example, the token “Current working directory” has two possible options: “Full directory” and “only the last part”. When tokens with additional configurations are selected, a window is displayed in which these configurations can be made. If you wish to change such a configuration, press the left mouse button on the token in the entry.

The Command Widgets

TDG can be extended by the module programmer through the Command widget making it possible to configure specific options with widgets s/he has developed. At the moment three such widgets exist: the directory/file browser, the color widget and the font widget.

The widgets appear as a button within TDG, and when the button is pressed, a new window is displayed in which the actual configuration can be done.

Save, Export and Reload

When you have configured the different options in TDG, you may wish to leave it and come back later to change some of the configurations. When you leave TDG, you can save your changes using an option in the File menu. Next time you enter TDG, your saved file will be one of the the files you are offered as a start-up configuration.

One important point to note is that this “save file” option is an internal dump of the state of TDG. That is, this file depends on the version of TDG and the module. Therefore, if you wish to send a given configuration to another person, this format is not appropriate. A version-independent format does exist called the export format. To create such a file, you have to select Export instead of Save in the File menu.

To restore the configuration on a single page to its original value or to merge another person's configuration with your own, select Reload in the File menu. To tell TDG that you want to reload only some of the pages, select the Detail button in the load window. This button brings up a window in which you can select the configuration pages to reload. Here you can also tell it how you want the pages to be reloaded. You have two possibilities:

  1. Overwrite—The pages that you are loading will totally overwrite the contents of the file.

  2. Merge—Tuples in the ExtEntries are appended to those already present in the module. Other configurations are ignored in the file.

Here's another difference between the save files and the export files—you cannot merge with save files. In other words, if you have a save file that you wish to merge, first you have to load and export it, and only then can you merge with it.

The End

Additional information as well as information on work currently in progress can be found on, the home page of TDG.

I have just finished a module for procmail, a mail filter for sorting your incoming e-mail.

John D. Hardin ( is working on a module for configuring the firewalling and IP Masquerading setup for stand-alone systems connected to the Internet via dial up. He may expand it to more general firewalling in the future.

If you have the time, I would 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 that describes how to create a module for TDG. Send me e-mail at, and I will be happy to help you get started.

Jesper Pedersen lives in Odense, Denmark, where he has studied computer science at Odense University since 1990. He is a system manager at the university and also teaches computer science. In his spare time, he does Jiu-Jitsu, listens to music, drinks beer and has fun with his girlfriend. He loves pets, and has a 200 litre aquarium and two very cute rabbits. His home page can be found at, and he can be reached via e-mail at

Load Disqus comments