DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Customizing the Desktop with rules

Structure of rule files

Rule files are text files, and can be created and edited using any suitable text editor, such as vi or scoedit.

Rule files consist of sequences of ``clauses''. Each clause can have one of the following two forms:

keyword=value ;

or

keyword { body } [ ; ]

Each rule clause in a rule file starts with a keyword specifying what type of rule it is. The keyword may have an abbreviation. Each keyword is typically followed by either a value, or a block enclosed in matching curly brackets containing further clauses.

In the second form the semicolon is optional. The body is normally a sequence of commands.

Rule files are block structured like the programming languages C or Pascal, and in general the layout is not important. For example, the following two rules are equivalent:

   icon_rules {* /D{picture=dir.px;}* /F{picture=file.px;}}
and:
   icon_rules
   {
      * /D
      {
         picture=dir.px ;
      }
      * /F
      {
         picture=file.px ;
      }
   }
The recommended layout, shown in the second example above, helps clarify the structure of the rule, and makes it easier to match pairs of brackets. This style of layout will be used for all the examples in this guide.

Within a rule file you can include:


To illustrate the characteristics of a typical rule, look at the following simple icon_rules clause, which defines the characteristics of an Edit icon:
   icon_rules
   {
      Edit /F
      {
         picture=edit.px;
         title=Editor;
         trigger_action: drop
         {
            edit -merge $dynamic_args
         }
      }
   }

The rule is introduced by the keyword icon_rules. This specifies it as a command to determine the behavior of an icon or group of icons.

The icons to which the command applies are defined by the construct Edit /F, where /F denotes files. In this case the rule applies to any file with the filename Edit.

The picture command specifies the file containing the picture for the icon, and the title command defines its title.

The trigger_action command defines what happens when the user performs an action on, or ``triggers'', an icon in a particular way. In this case the trigger ``action'' is drop, which occurs when the user drops one or more icons onto this icon using mouse button 1. This is followed in curly brackets by the action to be carried out under the specified circumstances.

Further examples of rules are given in the xdt3(XC) manual page. The default system rules for your system can be found in /usr/lib/X11/IXI/XDesktop/rules/system/xdtsysinfo. Please do not make any changes to this file, as they will not be supported if you later choose to upgrade. See ``Using Desktop modules'' and ``Defining Desktop user types'' for information on how to configure system-wide Desktop behavior without modifying the system rule file.

See also:


Next topic: Processing filenames in rules
Previous topic: Rule file precedence

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003