以 PDF 格式下载本书 (1326 KB)
Chapter 16 Customizing the Workspace ManagerThis chapter describes how to customize the desktop Workspace Manager. The Workspace Manager is the window manager provided by the desktop. Like other window managers, it controls:
In addition, the Workspace Manager controls these desktop components:
Many of these can be changed with Style Manager. Style Manager is able to make often-used changes quickly, with little effort on your part. Other resources must be set manually. The Workspace Manager is dtwm. It is based on the Motif Window Manager.
For additional information about setting resources, see Setting Application Resources. Workspace Manager Configuration FilesThe Workspace Manager gets information about the window menus, workspace menus, button bindings, and key bindings from a configuration file. It uses one of the following files:
The Workspace Manager searches for a configuration file in the order shown above, and uses the first one it finds. For users who use more than one session language, a personal, language-dependent configuration file HomeDirectory/.dt/language/dtwrmc can be created that takes precedence over HomeDirectory/.dt/dtwmrc. To Create or Modify a Personal Configuration FileThe personal Workspace Manager configuration file is HomeDirectory/.dt/dtwmrc. If this file exists, it is the file used.
To Create a System-Wide Configuration FileThe system-wide Workspace Manager configuration file is /etc/dt/config/language/sys.dtwmrc. Note – This file is not used if HomeDirectory/.dt/dtwmrc exists. To Include (Source In) Other FilesUse the syntax: include
{
path
path
…
}
For example, the following lines source in the file /users/ellen/mymenu: include
{
/users/ellen/mymenu
}
Include statements are useful for providing additional functionality without copying the entire configuration file. For example, a user might want to create a new key binding without having to administer the entire configuration file. The user can create a file HomeDirectory/.dt/dtwmrc with this content: include
{
/etc/dt/config/C/sys.dtwmrc
}
Keys DtKeyBindings
{
Alt<Key>F5 root f.menu Applications
} Menu Applications
{
"GraphicsApp" f.exec "/usr/bin/GraphicsApp/GApp"
…
}
To Restart the Workspace ManagerThe Workspace Manager must be restarted in order for changes made to the configuration file to take effect. Choose Restart Workspace Manager from the Workspace menu (press mouse button 3 when the pointer is on the backdrop). Customizing WorkspacesMost workspace customization, such as changing workspace names and the number of workspaces, can be done by the user using the desktop's interface. However, the Workspace Manager provides resources for setting system-wide defaults. To Change the Number of Workspaces on a System-Wide BasisThe default desktop configuration provides four workspaces. The user can add and delete workspaces using the pop-up menu associated with the Workspace switch. The /usr/dt/app-defaults/C/Dtwm file has the workspaceCount resource set to the following default number of workspaces: Dtwm*0*workspaceCount: 4 Dtwm*workspaceCount: 1 Multiple workspaces are specified on screen 0. A single workspace is specified on any other screen. You can create (or modify if it exists) the /etc/dt/config/C/sys.resources file to change the default number of workspaces for all new users on a workstation. Use the 0*workspaceCount resource to set the system wide default on the primary screen: Dtwm*0*workspaceCount: number For example, the following resource sets the number of workspaces system wide on the primary screen to six: Dtwm*0*workspaceCount: 6 For information about setting Workspace Manager resources, see Setting Application Resources. For example, the following resource sets the number of workspaces to six: Dtwm*workspaceCount: 6 To Provide System-Wide Workspace NamesInternally, the workspaces are numbered by the numbering convention wsn, where n is 0, 1, 2, and so on. For example, the default four workspaces are numbered internally ws0 through ws3. Dtwm*wsn: name For information about setting Workspace Manager resources, see Setting Application Resources. For example, the following resources set the default four workspaces to the specified names: Dtwm*ws0*title: Anna Dtwm*ws1*title: Don Dtwm*ws2*title: Julia Dtwm*ws3*title: Patti To Create Additional Backdrops
To Replace the Backdrop With a Graphics ImageThe backdrops are layered over the display's root window. The Style Manager Backdrop dialog box provides a NoBackdrop setting in which the backdrop is transparent. There is only one root window behind all the workspace backdrops. Thus, a graphics image placed on the root window persists across all workspaces. You can specify which workspaces cover up the root window with a backdrop. However, the image visible when NoBackdrop is in effect will be the same for every workspace.
Workspace Manager MenusWorkspace Manager has three default menus: Workspace menu—also called the root menu. Displayed when the user presses mouse button 3 when the pointer is on the backdrop. The menu is associated with the mouse button through a button binding. Window menu—the menu displayed when the user presses mouse button 1 or mouse button 3 when the pointer is on the Window menu button (upper left corner of the window frame). The menu is associated with the button by the windowMenu resource. Front Panel menu—the menu displayed when the user presses mouse button 1 or mouse button 3 when the pointer is over the Front Panel's Window menu button. Workspace Manager Menu SyntaxWorkspace Manager menus have the syntax: Menu MenuName
{
selection1 [mnemonic] [accelerator] function [argument]
selection2 [mnemonic] [accelerator] function [argument]
…
}
where: selection—the text or bitmap that appears on the menu. If the text includes spaces, enclose the text in quotation marks. For bitmaps, use the syntax @/path. mnemonic—a single character that acts as a keyboard shortcut when the menu is displayed. It is specified in the form _character. accelerator—a keyboard shortcut that is active whether or not the menu is displayed. Accelerators have the syntax modifier<Key> Keyname where modifier is Ctrl , Shift, Alt (Extend char), or Lock. For a list of all possible key names, refer to the keysymdef.h file in your "X11 include" directory. function—the function to be performed when this selection is made. Refer to the dtwmrc(4) man page for a list of functions. argument—function arguments. Refer to the dtwmrc(4) man page for more details. For example, the following menu item labeled Restore normalizes the window. When the menu is displayed, typing "R" will also restore the window. Pressing Extend char F5 will also restore the window. Restore _R Alt<Key> F5 f.normalize Note – For complete information on Workspace Manager menu syntax, see the dtwmrc(4) man page. To Add a New Menu Item to the Workspace Menu
Note – To change the menu item's position on the Workspace Menu, see To Modify the Workspace Menu. To Modify the Workspace Menu
To Create a New Workspace (Root) Menu
To Create a New Window MenuNote – The Window menu is built into the Workspace Manager, and ordinarily is not customized. To keep window behavior consistent between applications, you should avoid extensive modification to the Window menu.
Customizing Button BindingsA button binding associates a mouse button operation and possible keyboard modifier key with a window manager function. Button bindings apply to all workspaces. The desktop default button bindings are defined in the Workspace Manager configuration file in a button binding set named DtButtonBindings: Buttons DtButtonBindings
{
…
}
Button Binding SyntaxThe syntax for button bindings is: Buttons ButtonBindingSetName
{
[modifier]<button_nameMouse_action> context function [argument]
[modifier]<button_nameMouse_action> context function [argument]
where: button_name—Btn1—Left mouse button Btn2—Middle button (3-button mouse) or both buttons (2-button mouse) Btn3—Right button Btn4—Buttons 1 and 2 together on a 3-button mouse Btn5—Buttons 2 and 3 together on a 3-button mouse modifier—Ctrl, Shift, Alt, Lock mouse_action—Down—Holding down a mouse; button Up—Releasing a mouse button; Click—Pressing and releasing a mouse button; Click2—Double-clicking a mouse button; Drag—Dragging the mouse while holding down the mouse button context—indicates where the pointer must be for the binding to be effective. If necessary, separate multiple contents with the "|" character. root—The workspace window; window—Client window or window frame; frame—Window frame, excluding the contents; icon—Icon; title—Title bar; app—Client window (excluding the frame) function—one of the window manager functions. Refer to the dtwmrc(4) man page for a list of valid functions. argument—any window manager function arguments that are required. Refer to the dtwmrc(4) man page for details. For example, the following line causes the menu described in DtRootMenu to be displayed when mouse button 3 is pressed while the pointer is in the workspace window (but not within client windows). <Btn3Down> root f.menu DtRootMenu Note – For complete information on button binding syntax, see the dtwmrc(4) man page. To Add a Button Binding
To Create a New Button Binding Set
Customizing Key BindingsA keyboard binding, also known as a key binding, associates combination of keys with Workspace Manager functions. Key bindings apply to all workspaces. Note – Be careful about using a common key combination as a keyboard binding. For example, Shift-A normally puts the letter "A" into your current window. If you bind Shift-A to a function, you lose its normal usage. Default Desktop Key BindingsThe desktop default key bindings are defined in the Workspace Manager configuration file in a key binding set named DtKeyBindings: Keys DtKeyBindings
{
…
}
Key Binding SyntaxThe syntax for key bindings is: Keys KeyBindingSetName
{
[Modifiers]<Key>key_name context function [argument]
[Modifiers]<Key>key_name context function [argument]
…
}
where: Modifiers—Ctrl, Shift. Alt, and Lock. Multiple modifiers are allowed; separate them with spaces. key_name—the key to which the function is mapped. For keys with letters or numbers, the key_name name is usually printed on the key. For instance the name of the "a" key is "a", and the "2" key is named "2". The "Tab" key is named "Tab". The "F3" key is named "F3". For other keys, the name is spelled out—for example, plus for the "+" key. The file keysymdef.h, located in a system-dependent directory, contains additional information about key names. context—the element that must have the keyboard focus for this action to be effective. These can be concatenated together if the binding applies to more than one context. Multiple contexts are separated by the "|" character. root—Workspace backdrop; window—Client window; icon—Icon function—a window manager function. Refer to the dtwmrc(4) man page for a list of valid functions. argument—any window manager function arguments that are required. Refer to the dtwmrc(4) man page for details. For example, the following key binding lets the user to switch the keyboard focus to the next transient window in an application by pressing Alt+F6. Alt<Key>F6 window f.next_key transient Note – For complete information on key binding syntax, see the dtwmrc(4) man page. To Create a Custom Key Binding Set
Switching Between Default and Custom BehaviorTo toggle between Motif default and CDE desktop window behavior: |
|