Although one of the aims of Sawfish is to provide as much flexibility as possible, this can sometimes be detrimental to the overall experience. For example, it would be easier for the user if all themes use consistent keymaps and cursor images in conceptually similar parts of window frames. That is, it would be better if all close buttons had the same mouse button bindings and the same mouse cursor displayed when the pointer is over them.
To achieve this, Sawfish defines a number of classes of frame parts, each with several default attributes. When defining a window frame, the definitions of each part then specifies which class it is a member of, and inherits the associated default attributes (provided that it hasn’t explicitly specified values for these attributes).
This variable is an association list, associating symbols naming frame part classes with an association list of default attributes for that class.
The names of the pre-defined classes are as follows, their meanings should be self-explanatory:
Extra classes can be created by adding to
However, it’s likely that more than one theme may need to use the same
class, and that the user may then wish to customize any extra keymaps
def-frame-class macro should be used to add new
classes, since it handles these situations.
Creates a new frame part class named by the symbol CLASS.
The ALIST-FORM is evaluated to give an association list defining attributes for the class. Each key-value pairs is only set if no existing value exists for that key.
If binding-forms are given, they will be evaluated when no keymap already exists for the class. A keymap will be created, and stored in the variable named ‘class-name’. This variable may then be used within the binding-forms.
So to define a hypothetical
shade-button class, the following
might be used:
(def-frame-class shade-button '((cursor . left_ptr)) (bind-keys shade-button-keymap "Button1-Off" 'toggle-window-shaded))
In some cases it might be valuable to be able to override pre-defined frame part properties. For example, it might be your preference that text in window title bars is always blue.
Creates a new frame part class named by the symbol class.
def-frame-class, the trailing argument is just a boolean
flag. This flag only indicates whether to create a keymap for the
class. Any bindings have to be established through a separate call to
The function returns
t if it was able to create and bind the
nil otherwise. This allows us to check for
frame-part-classes except that the properties take
precedence over values defined both in that variable and in the frame
The following function may be used to simplify the customization of these two variables:
Associate value with property key for all frame parts of class class.
If override is non-nil, then the setting is installed in the
override-frame-part-classes variable, otherwise it’s stored in
The following example would override the colors of all title bars:
(set-frame-part-value 'title 'background '("black" "white" "green" "blue") t)
(See the next section for details about what is actually being set here.)