Solaris Common Desktop Environment: Advanced User's and System Administrator's Guide

Chapter 16 Customizing the Workspace Manager

This 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 Files

The 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 File

The personal Workspace Manager configuration file is HomeDirectory/.dt/dtwmrc. If this file exists, it is the file used.

  1. Double-click Edit Dtwmrc in the Desktop_Tools application group.

    If you already have a personal dtwmrc file, it is loaded into the editor. If not, sys.dtwmrc is copied to HomeDirectory/.dt/dtwmrc, which is then loaded into the editor.

  2. Edit the file.

  3. Exit the editor.

    The file is saved as your personal dtwmrc, regardless of its original source.

To Create a System-Wide Configuration File

The system-wide Workspace Manager configuration file is /etc/dt/config/language/sys.dtwmrc.

    Copy /usr/dt/config/language/sys.dtwmrc to /etc/dt/config/language/sys.dtwmrc.


Note –

This file is not used if HomeDirectory/.dt/dtwmrc exists.


To Include (Source In) Other Files

    Use 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 Manager

The 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 Workspaces

Most 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 Basis

The 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 Names

Internally, 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.

    Use the title resource to change the name of a specified workspace:

	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

  1. Create the backdrop images. They can be bitmap or pixmap files.

  2. Place the backdrops in one of the following directories. (You may have to create the directory.)

    • System-wide backdrops: /etc/dt/backdrops

    • Personal backdrops: HomeDirectory/.dt/backdrops

  3. Choose Restart Workspace Manager from the Workspace menu.

    The system-wide and personal backdrops are added to the built-in backdrops in /usr/dt/backdrops.

    You can replace an existing built-in backdrop by creating a personal or system-wide backdrop with the same name.

To Replace the Backdrop With a Graphics Image

The 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.

  1. Create the graphics image.

    The image must be in a format for which a tool exists to display it on the root window. For example, if you intend to use xsetroot, you must create a bitmap file.

  2. If it doesn't already exist, create an executable file HomeDirectory/.dt/sessions/sessionetc.

    The sessionetc file is run each time the user logs in.

  3. Place the command to display the image in the sessionetc file.

    For example, the following command tiles the root window with the specified bitmap:

    	xsetroot -bitmap /users/ellen/.dt/icons/root.bm

Workspace Manager Menus

Workspace 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 Syntax

Workspace 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

  1. Click the Add Item to Menu control on the Tools subpanel of the Front Panel.

    The Add Item to Workspace Menu dialog is displayed.

    Graphic

  2. Type a complete path or click Browse and select the path of the file you want the new menu item to run.

    The file you point to should normally be available to this host. It should be an executable file or a file of a data type (e.g. Audio or Manpage) registered to the host.

    The complete path including filename is displayed in the text box.

  3. Click Add to add the file to the menu.

    The file is added to the first position in the Workspace Menu. Its default icon (if any) and filename will be used as the icon and text for the menu item.


Note –

To change the menu item's position on the Workspace Menu, see To Modify the Workspace Menu.


To Modify the Workspace Menu

  1. Click the Customize Workspace Menu control on the Tools subpanel of the Front Panel.

    File Manager is displayed showing the configuration folder for the Workspace Menu. Note that the files in this folder represent each menu item, and subfolders represent each sub-menu. By rearranging the contents of the Workspace Menu folder, you rearrange the Workspace Menu.

    Graphic

  2. Drag and drop any menu item you wish to move to a new location under this subfolder.

    For help using File Manager in Tree View mode, see Solaris Common Desktop Environment: User's Guide.

  3. Delete any unwanted menu items by dragging their files to the Trash can on the Front Panel.

  4. Rename any menu items you want to rename by editing their file or folder names.

  5. When you are satisfied with the changes you have made, choose Update Workspace Menu from the File menu in File Manager and exit File Manager.

    The Workspace Menu now reflects the changes you made in the Workspace Menu folder.

To Create a New Workspace (Root) Menu

  1. Open the appropriate file for editing:

  2. Create the new menu:

    	Menu menu_name
     	{
     	        …
     	}

    See Workspace Manager Menu Syntax.

  3. Create or edit the button binding to display the new menu.

    If the menu replaces the existing menu, edit the button binding that displays the Workspace menu.

    	<Btn3Down> root  f.menu  menu_name
    

    If the menu is an additional menu, create a new mouse button binding. For example, the following button binding displays the menu when Shift-mouse button 3 is pressed over the backdrop:

    	Shift<Btn3Down> root  f.menu  menu_name
    
  4. Choose Restart Workspace Manager from the Workspace menu.

To Create a New Window Menu


Note –

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.


  1. Open the appropriate file for editing:

  2. Create the new menu:

    	Menu menu_name
     	{
     	        …
     	}
  3. Use the windowMenu resource to specify the new menu:

    	Dtwm*windowMenu: menu_name
    
  4. Choose Restart Workspace Manager from the Workspace menu.

Customizing Button Bindings

A 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 Syntax

The syntax for button bindings is:

Buttons ButtonBindingSetName
 {
     [modifier]<button_nameMouse_action>   context  function  [argument]
     [modifier]<button_nameMouse_action>   context  function  [argument]

where:

button_nameBtn1—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

modifierCtrl, Shift, Alt, Lock

mouse_actionDown—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

  1. Open the appropriate file for editing:

  2. Add the button binding to the DtButtonBindings definition.

    Do not bind the same button to different functions for the click and press operations, and do not bind more than one function to the same button and context.

  3. Choose Restart Workspace Manager from the Workspace menu.

To Create a New Button Binding Set

  1. Open the appropriate file for editing:

  2. Create the new button binding set. See Button Binding Syntax.

  3. Set the buttonBindings resource to the new name:

    	Dtwm*buttonBindings: ButtonBindingsSetName 
    
  4. Choose Restart Workspace Manager from the Workspace menu.


    Note –

    The new button bindings replace your existing button bindings. Copy any button bindings you want to keep from DtButtonBindings.


Customizing Key Bindings

A 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 Bindings

The desktop default key bindings are defined in the Workspace Manager configuration file in a key binding set named DtKeyBindings:

Keys DtKeyBindings
 {
  …
 }

Key Binding Syntax

The syntax for key bindings is:

Keys KeyBindingSetName
 {
    [Modifiers]<Key>key_name   context   function  [argument]
    [Modifiers]<Key>key_name   context   function  [argument]
    …    
 }

where:

ModifiersCtrl, 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

  1. Open the appropriate file for editing:

  2. Create a new key binding set with a unique KeyBindingSetName. Use the desktop default key binding set, DtKeyBindings, as a guide.

  3. Set the keyBindings resource to the new set name:

    	Dtwm*keyBindings: KeyBindingSetName 
    
  4. Choose Restart Workspace Manager from the Workspace menu.


    Note –

    The new key bindings replace your existing key bindings. Copy any key bindings you want to keep from DtKeyBindings into your new set.


Switching Between Default and Custom Behavior

To toggle between Motif default and CDE desktop window behavior:

  1. Press Alt+Shift+Ctrl+!

  2. Click OK in the dialog box.

    Switching to default behavior removes the Front Panel and any custom key and button bindings.