The Dotfile Generator

The Dotfile Generator is a useful tool to help in configuring programs by using X11 widgets to make option choices.
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.