Homepage News Screenshots Documentation Downloads Patches Links Developers


Download Current Version: tkdesk-1.2.tar.gz

Next Previous Contents

9. Configuration of TkDesk

Currently, TkDesk can be configured only by editing ASCII files. This is not necessarily a drawback, because this way you can add complex Tcl/Tk procedures to the configuration files. GUI based configuration is planned for one of the next releases.

If you don't know Tcl/Tk: Don't despair! For the biggest part of TkDesk's configuration files it is absolutely not necessary for you to know how to program in Tcl/Tk, since you just have to modify values or extend the examples I and others have provided. And to those who want to exploit all of the power available by using Tcl/Tk as TkDesk's configuration language, please have a look at the answer to FAQ Where can I find out more about Tcl/Tk?.

The configuration files can be accessed from the TkDesk menu via the Configuration submenu, or from the "Configuration" submenu of the popup menu of the application bar's first button. The built-in editor will then appear with the selected configuration file(s) already loaded. Each configuration file contains pretty detailed comments on what the individual settings are for, and how they can be modified. Well, at least they contain examples, which can guide your modification attempts. Once you have modified the configuration file, you can save it and reload it into TkDesk by making use of the entries of the editor's "Configuration" menu described in section The Built-in Editor. Use F5 to save the file and reload it into TkDesk, and F6 to do the same but additionally close the configuration file.

As already mentioned, each configuration file contains directions on how to modify its definitions. The general advice is: Simply look at the example definitions, because these make things a great deal clearer than any explanation can.

Tip: In case your looking for the definition of a specific part of TkDesk, e.g. for the popup menu of pdf files, use the "Find..." entry in the "Configuration" menu. Just enter pdf in the "String:" field, hit enter, and double-click the found file.

9.1 Configuration Files

All of these are "sourced" (i.e. processed) by TkDesk during start-up. This happens in the following order:

  1. System
  2. ButtonBar
  3. Preferences
  4. FileTags
  5. Commands
  6. Directories
  7. Popups
  8. AppBar
  9. Sounds
  10. Local (if existent)

AppBar

This configuration file lets you define all aspects of the application bar (apart from its layout, use the entries of the submenu "Application Bar" of the comet-button's popup menu for this). This is what you can define here:

  • If the application bar should be managed by the window manager just as an ordinary window. I don't like this, so this is disabled by default :-).
  • The maximum number of buttons in a column (vertical layout) or row (horizontal layout). Yes, the application bar can contain several columns or rows!
  • The fonts to use for the time and date display.
  • Period in seconds after which to update the system load and mailbox displays, where to check for new mail, plus several additional mail related options.
  • Icons and commands to use for the dial-up networking button.
  • Icons and fonts to use for the trash button, and whether to display its current disk usage in the appbar.
  • The actual button definitions, ie. which image to display, and the entries of the (possibly cascaded) popup menu. See below for the syntax used.

ButtonBar

This file defines the contents and appearance of the Button Bar, which is displayed underneath the menu bar of TkDesk's file browser (tkdesk(button_bar)) or file list windows (tkdesk(small_button_bar). Both button bars are configured independently from one another.

The third list defined here (tkdesk(dir_button_bar)) is for directory-specific button bars which will be dynamically displayed and hidden when the respective directory is entered or left. These will be displayed in addition to the standard button bar.

Commands

In this file you can define entries which will be added to TkDesk's "Command" menu, for example to uncompress all selected files, manage RPM package files, or do whatever you can possibly imagine.

Directories

Here you can define entries and cascaded submenus of directories which will be added to TkDesk's "Directories" menu. More details are contained in the "Directories" file itself.

You can also define a list of directories whose parent directories are not to be displayed in file browser windows, as is usually the case with your home directory. This can speed up display of directories underneath an AFS directory, for instance.

Another list lets you define action that are to be performed when a specific directory is opened. This can be used for example to auto-mount floppies and CDROM's.

FileTags

Contains definitions for color and font of specific file types (as distinguished by their extension) as well as standard values for regular files, executables, and directories, that will be used in TkDesk's file lists. Also the icons displayed when the "Add Icons" option is selected are configured here, as well as the icons used for the desk items, i.e. files and directories which have been dropped on the root window.

Local

This file does not exist when TkDesk gets installed, but still appears in the "Configuration" menu. This is because if it exists it will be sourced during start-up of TkDesk, so this is the ideal place to put local extensions of TkDesk.

Popups

The popup menus that appear when the right mouse button is clicked over a file or directory are defined here. There are individual definitions for the popup menus of directories, executables, and of other files. To find the correct popup menu for a file TkDesk checks the mask of each entry of a popup list one after the other from the beginning of the list to its end, so the masks should become more general towards the end of the list.

An additional popup list (tkdesk(fileops,popup)) may be defined here for use in the "Copy, Move, etc." dialog.

Sounds

Here the command to be used for playing sounds can be defined, as well as the sound files which are to be played at certain events. TkDesk comes with a few AU sound files which are located in the sounds subdirectory of TkDesk's library directory. You can find out where this is by looking at the fifth line of the tkdesk script.

System

All the more "basic" features of TkDesk can be configured here. These are:

  • Colours and fonts to be used by TkDesk,
  • Default size of file listboxes,
  • Definitions of shell commands which are used by TkDesk to copy, move, delete, etc. files. These should be fine as they are in most cases, but you may want to tweak them for your system, so take a look at these definitions.
  • The default command for printing,
  • Which editor to use, plus settings for the built-in editor,
  • Periods for automatic refreshing of the file lists and saving of TkDesk's configuration,
  • Maximum number of entries in history menus,
  • If TkDesk should ask for confirmation when the user wants to quit TkDesk,
  • If TkDesk should allow the menus to be "tearoff-able",
  • The paths in which TkDesk will look for images and sounds used in the configuration files,
  • Icons to use for file list and browser windows, and for the help window,
  • Whether to use "focus follows mouse" default or not,
  • Settings for the desk items, e.g. whether to let them be managed by the window manager,
  • Commands to execute after start-up and before shutdown (of TkDesk).

9.2 The TkDesk API

Many of the values to be specified for TkDesk's configuration files are Tcl scripts. Also, you can define your own Tcl proc's to use in these scripts. To allow better control of TkDesk, TkDesk externalizes a couple of proc's which could be called the "TkDesk API" (although currently they aren't much more then a random set of more or less useful proc's, but anyway).

The proc's I currently think are part of the API are the following:

dsk_msg_alert msg

Display msg in an alert dialog box.

dsk_msg_error msg

Display msg in an error dialog box.

dsk_msg_info msg

Display msg in an info dialog box.

dsk_confirm msg script

Display msg in a dialog box with "OK" and "Cancel" buttons. Evaluate script if user pressed "OK".

dsk_debug msg

If TkDesk runs in development mode (e.g. by setting the -devel command line option) print msg to stderr.

dsk_ask_dir

Ask for a directory to open.

dsk_ask_exec

Ask for a command to execute or file to open.

dsk_exec command

Execute command in the background. When the command completes its exit code will be displayed in the status bar of all file browser windows.

dsk_exec_as_root command

Asks for the root password, and executes command in the backgroud under root permission if it was okay.

dsk_view command

Execute command in the background and displays its output (stdout and stderr) in a built-in editor window.

dsk_view_as_root command

Same as dsk_view but asks for the root password first.

dsk_path_exec path command

Executes command in path and in the background.

dsk_path_view

Executes command in path and in the background, and displays its output in an editor window.

dsk_edit ?+linenum? ?file? ...

Without arguments asks for a file to open, or opens all files in the same editor window, positioning the cursor at line linenum if given. If file is "New File" a black editor window will be opened.

dsk_busy

Displays mouse as "busy" and locks all TkDesk window from receiving mouse events.

dsk_lazy

Displays mouse as "lazy", and makes all TkDesk windows responsive again.

dsk_active what

Returns information about the currently active file browser or list window: If what is "dir" it returns its directory; if it is "sel" it returns all selected items as a Tcl list; if it is "win" it returns the Tk name of the active window.

dsk_select X ?names?

If names is not given, copies the full path names of the files selected in the currently active file browser or list window to the X selection. Otherwise just their names are copied.

dsk_read_string msg ?script? ?dontpaste?

Displays $msg in a dialog box where the user can enter an arbitrary string. If script is not given, the string will be returned; if it is given the variable dsk_read_string will be set to the user's input and script will be evaluated. If "dontpaste" is passed as a third argument to this command the current X selection will not be pasted into the entry field.

dsk_filesel message path

Opens TkDesk file selection dialog using message as the label, and presetting the entry field with path. Path is also used as the filter for the full file selection box.

dsk_refresh ?file ...?

For each file all windows displaying the corresponding directory is refreshed. File may also be a directory.

dsk_sound sound

Plays sound if a sound command has been defined and sound is switched on. Sound is the second index in the tkdesk(sound,xxx) array as defined in the "Sounds" config file ("xxx" in this case).

dsk_copy ?source ...? ?dest?

Opens the "Copy, Move, etc." dialog box, filling in "Source" and "Destination" fields if provided.

dsk_dialup phonenumber

Without arguments asks for a phone number, and passes this to the command specified in tkdesk(appbar,dialup,cmd_up), else it does the same without asking.

dsk_find_files ?options?

Opens the "Find Files" dialog, presetting its fields from the options. The following options are available: -path path, -mask mask, -string string, -regexp regexp, -extreg extreg, -type "all|file|dir|sym|socket|pipe", -owner owner, -group group, -modified mod, -accessed acc, -size size, -case, -samefs, -followsym. If the option -doit is given the search will start as soon as the dialog is displayed, without having to press "Search".

dsk_mail file ?string?

Asks for an email address where to send file. If file is the empty string, string will be sent instead.

dsk_netscape what ?url? ?args?

This proc is used to communicate with a running netscape. If Netscape is not running yet it will be started first. What may be "file", "url", or "rcmd" (Communicator only); url may be a regular URL, a file name, or, if what is "rcmd", it may be "mail", "news" or "edit". Args may be "window", or "raise", or both.

dsk_periodic command seconds

Opens the "Periodic Execution" window and executes "command" every "seconds" seconds.

dsk_open viewer file

Opens file by performing its default action. Viewer should be given as ""; I just didn't manage to get rid of this obsolete argument yet.

dsk_open_browser dir

Opens dir in a new file browser window.

dsk_open_dir dir

Opens dir in a new file list window (unless the option "Always in Browser" is set).

dsk_openall ?files?

Opens all files if given, or all currently selected files by performing their respective default action.

9.3 Shortcuts

When specifying Tcl scripts in the popup and appbar configuration lists (tkdesk(popup,...) and tkdesk(appbar)), and in some other places as well (precide, hus?), you can use a number of shortcuts that will be expanded just before evaluation:

%s

Will be replaced with the full pathname of the first selected file.

%f

Will be replaced with its filename only.

%b

Will be replaced with its filename without extension ("basename").

%d

Will be replaced with its directory only.

%A

Will be replaced with a Tcl list of the full pathnames of all currently selected files, or of the files dropped on an appbar button.

%a

Same as %a, but replaces with a list of filenames only.

%B

Same as %A but doesn't complain if no files are selected. Instead it will be replaced with the empty string.

%D

Will be replaced with the directory of the currently active file list or browser window.

%x

Will be replaced with the contents of the X selection.

%X

Same as %x but doesn't complain if the selection is empty.

%S

For the "Copy, Move, etc." popup menu; will be replaced of what's been entered into the "Source" text entry field.

%D

For the same popup menu; will be replaced of what's been entered into the "Destination" text entry field.

9.4 Utilities

To make life while configuring TkDesk a little easier as long as there's no GUI configuration available yet, TkDesk provides four little "helper" tools that help with selecting colors, fonts, icons, and sounds, by using graphical mouse-based dialog boxes. These are accessed through the "Configuration" menu, and are basically all handled in the same way.

Each of these dialogs contains three buttons:

Insert

Works only correctly if the dialog was invoked from the editor's "Configuration" menu. Inserts the current value at the cursor position in that editor window.

Select

Copies the selected value to the X selection, so it can be pasted at arbitrary places using the middle mouse button.

Close

Closes the dialog.


Next Previous Contents

Maintainer: J. Chris Coppick