Before you modify any CDE configuration files, first develop a strategy. I know that I've mentioned this before, but it's important enough to mention again. The following questions should get you started:
It's also a good idea to have handy a binder containing man pages for each of the CDE components (for looking up resources and their values) and a copy of each of the CDE configuration files. Now that you have a good understanding as to how CDE works, I'll lead you through making changes and customizing the system for either the entire user community or each individual user . I'll precede each change with a discussion of what is involved in making the change. I'll be making some basic, simple changes as well as some more advanced changes to show you how versatile CDE can be. One thing I need to mention is that all these changes can be made on any system. And knowing how to do these tasks "the hard way" increases your understanding of what these tools are doing for you in the background. So be sure to give each one a try. Making Changes Using Style ManagerFont Size When we first log in to CDE and the workspace comes up, as shown in Figure 14-4, one of the first things many users change is the size of the font. Initially set to 4, most users want a bigger font. This change is easy.
Figure 14-4. Style Manager
Backdrop and ColorsThe Style Manager is also where we can change the backdrop and colors:
Adding Objects to or Removing Objects from the Front PanelThe front panel can make life just a little easier for us by including frequently used items on it. One of the most frequent actions is opening up a terminal window. And although CDE comes with dtterm as the default terminal window, we sometimes might want to use an xterm window. We'll add it to the Personal Applications subpanel, where dtterm lives on AIX and HP-UX systems. Solaris users can do the same by putting the xterm on the Hosts subpanel, where the This Host terminal emulator lives. You have two ways to add objects to the CDE front panel:
The basic actions to add a control button through drag and drop are as follows :
Now if we want to include xterm on the front panel:
Adding Another Workspace Another easy change to the front panel is to add another workspace. CDE comes with a default of four workspaces, but this is easy to change. We'll add one more and call it "Web View." This can be the window where we'll access the Internet.
If we want to delete a Workspace, simply right-click on the Workspace to be removed and then select delete. Making these kinds of changes is easy, and they help personalize the workspace for the individual user. Changing the Front Panel in Other WaysIn addition to adding and removing buttons , you can shape the front panel in other ways. These other ways use Workspace Manager resources to modify default values. The following resources relate to the front panel:
Like all other workspace manager resources, these front-panel resources have the following syntax: Dtwm*screen*resource: value For example, suppose that instead of the default four workspaces, all that your users need is a front panel with six workspaces named Mail, Reports, Travel, Financials, Projects, and Studio. Further, they prefer a large font and have decided upon New Century Schoolbook 10-point bold. As system administrator, you'd make everyone happy with the following resource specifications: Dtwm*0*workspaceList: One Two Three Four Five Six Dtwm*0*One*title: Mail Dtwm*0*Two*title: Reports Dtwm*0*Three*title: Travel Dtwm*0*Four*title: Financials Dtwm*0*Five*title: Projects Dtwm*0*Six*title: Studio Dtwm*0*highResFontList: -adobe-new century schoolbook-bold-r-normal\ --10-100-75-75-p-66-iso8859-1 The screen designation is usually , except for displays capable of both image and overlay planes. The order of screens in the X*screens file is what determines the screen number; the first screen, typically the image plane, is designated as 0. Note also the inclusion of workspace names (One, Two, Three, Four, Five, and Six) in the six title resource specifications. These changes can be added to the sys.resources file, which is discussed in detail in the section "Advanced CDE Topics" later in this chapter. These changes can also be made by use of the EditResources action to insert the new resource lines into each user's RESOURCE_MANAGER property and then restart the Workspace Manager. The obvious disadvantage is that you have to physically go to each user's work area and take over the machine for a few minutes. However, on the plus side, the changes are immediate and are automatically saved in the correct dt.resources for users who restore their current session. You also avoid having your changes overwritten, which could happen if you modify the right dt.resources file at the wrong time, while the user is still logged in. Modifying Things in Slide-up SubpanelsSubpanels are defined in dtwm.fp after the front panel and front-panel control definitions. To associate a subpanel with a front panel control button, the front-panel control name is listed as the container name in the subpanel definition. Note : /etc/dt is where global changes are made. $HOME/.dt is where local or individual user changes are made. To add a slideup subpanel to the front panel, follow these steps:
As with front panel control buttons, it's easier to copy and modify an existing subpanel file than to start from scratch. Changing the Default Printer Name Display We'll now make an easy change to one of the slide-up subpanels. If we pop up the Personal Printers subpanel, it shows that we have a default printer configured, but not the name of it. Let's go back into the front panel file, dtwm.fp , and change that:
Pop up the Personal Printers subpanel to see what the default printer really is. Of course, if we change the default, we'll have to change the front panel again. But we know how to do that now, don't we! Figure 14-5 shows the Front Panel. Figure 14-5. Front Panel with Changes
Front Panel AnimationAnimation for front panel or slide-up subpanel drop zones is created by displaying a progressive series of bitmaps. By convention, the bitmaps are in /usr/dt/appconfig/icons . The list of bitmaps to display is contained in animation definitions at the end of dtwm.fp . To create an animation sequence for a drop zone:
Adding Items to the Workspace MenuThe workspace menu is defined in the sys.dtwmrc file. As mentioned in the overview of the front panel for Solaris, the Workspace Menu is accessed by placing the mouse over a blank area of the desktop and pressing the right mouse key. Where AIX and HP-UX come with a generic menu, Solaris has incorporated the front panel and subpanel actions into the Workspace Menu as another way to access these actions. However, we can create customized Workspace Menu for all three systems using the left mouse key to access it. We'll be doing this task next . A customized Workspace menu can contain frequently used commands and applications. The customized menu is usually accessed by pressing the left mouse button, which pops up the menu for viewing and selection. A Workspace menu comes in handy for those who have a set number of things they do regularly. For instance, a programmer who uses C++, vi , and isql may have a menu with those items, or a system administrator may have a menu with df, ps -ef , and netstat on it. Or those on an expansive network may want a menu of system logins. For one or two changes, you can modify the existing Workspace menu. For major changes, it's probably easier to insert an entirely new menu definition in sys.dtwmrc . A menu definition has the following syntax: Menu MenuName { "Menu Name" f.title "Frame" f.exec /nfs/system1/usr/frame/bin/maker "Second Item" action "Third Item" action } The first line specifies the menu name, following the keyword Menu . The lines between the curly braces list the items that appear in the menu in their order of appearance; thus the first line is the title as designated by the function f.title . The second line is an example of a definition that would start FrameMaker from a remote application server in a distributed environment. Numerous other functions exist, approximately 45 in all. For a complete list, see the dtwmrc (4) man page. For users to display the menu, you need to bind the menu definition to a mouse button and a screen location using the action f.menu MenuName . For example, if your users want to post the menu by pressing mouse button 3 when the pointer is on the workspace background, you would insert the following line in the Mouse Button Bindings Description section at the end of sys.dtwmrc : <Btn3Down> root f.menu MenuName (Actually, it would be easier to modify the line that's already there by exchanging MenuName for DtRootMenu on the second line.) Now we'll create a simple menu. Our menu is going to include running FrameMaker, running the vi editor, and logging into a remote system.
Creating pull-down menus is easy and can easily be expanded by adding submenus to the menu. Just use the function f.menu followed by the menu name. Add the following just after "Admin1's Menu": Performing these advanced functions really isn't so hard. The hardest part is remembering which directories to put the files in: /etc/dt for global changes or $HOME/.dt for individual changes. Creating Control Buttons, Actions, and File TypesAn action starts a process such as a shell script or an application. An action can be connected to a front-panel button to start when the button is clicked. An action can be connected to a front panel drop zone to be performed when a data file is dropped on the drop zone. An action can be associated with an icon in a file manager window so that the action can be started by double clicking the icon. An action can be associated with a particular data type so that double-clicking the data file icon starts the action and opens the data file. In addition to setting up a front panel and default session to meet your user's needs, the single most important thing you can do to make computing life easier for the people who depend on you is to create actions and data types. CDE actions and data types are defined in files that end in .dt . Similar to most other CDE configuration files, *.dt files have a system-wide version that can be copied into a user's personal directory and customized for personal use. Most system-wide *.dt files are found in /usr/dt/appconfig/types/C ; personal *.dt files are created by copying user-prefs.dt from /usr/dt/appconfig/types/C to $HOME/.dt/types . The default search path that CDE uses to look for actions and file types includes the following main directories in the order listed:
You can add more directories to the search path using the DTDATABASESEARCHPATH environment variable. Insert this environment variable and the new search path into /etc/dt/config/Xsession for a system-wide influence. Insert the environment variable and search path into $HOME/.dtprofile for individual users. The basic control definition has six parts :
To remove a control button from the front panel, type a pound sign (#) in the left-most column of the CONTROL definition line. The (#) turns the control specification into a comment line. Add a control button by editing the dtwm.fp file:
Action and File Types have their own peculiarities in that each has a couple of parts, and each must live in its own directory location. These peculiarities will become clear as we create an action on the subpanel. The following are the recommended locations in which to create an action or file type definition:
A typical action has the following syntax: ACTION ActionName { TYPE type keyword value keyword value } For example, here's a FrameMaker action: ACTION FRAME { TYPE COMMAND WINDOW-TYPE NO-STDIO EXEC-STRING /nfs/hpcvxmk6/usr/frame/bin/maker } A typical data type has the following syntax: DATA_ATTRIBUTES AttributesName { keyword value keyword value ACTIONS action, action } DATA_CRITERIA { DATA_ATTRIBUTES AttributesName keyword value keyword value } Note that all definitions have the following general syntax: KEYWORD value Notice that a data type definition is actually in two parts: an attribute part and a criteria part. The attribute portion of the data type definition specifies the look of the datatype; the criteria portion specifies the behavior of the data type. For example, here's a file type for FrameMaker files that uses the FRAME action: DATA_ATTRIBUTES FRAME_Docs { DESCRIPTION This file type is for FrameMaker documents. ICON makerIcon ACTIONS FRAME } DATA_CRITERIA { DATA_ATTRIBUTES_NAME FRAME_Docs NAME_PATTERN *.fm MODE f } You can create actions and file types from scratch using these formats. However, the easiest way to create an action is to use the CreateAction tool. CreateAction is located in the Desktop Applications folder of the Applications Manager and presents you with a fill-in-the-blank dialog box that guides you through creating an action.dt file containing the action definition. You can then move this file to the appropriate directory for the range of influence you want the action to have: /etc/dt/appconfig/types for a system-wide influence; $HOME/.dt/types for individual users. Creating a New Icon and Action Creating an icon is a challenging task. We could use the Icon Editor found in Desktop_Apps to create a new icon, or we could find a picture we like and use it. One thing to be careful of when pulling in a picture, in order for it to be seen correctly on the front panel, is that it has to be no larger than 32x32 pixels or only a portion of the icon will be displayed. Viewing the picture in the Icon Editor shows you the size of the picture. You may want to search through the application directories for useful icons or pull one down from the Internet. For this entire example, I'm going to use the Instant Information software that comes with HP-UX. This is the manual set on the CD. Other application software will work just as well; just make sure that your paths correspond with the software you are using. Also, I'm going to use a fictitious user's home directory: /home/admin1 .
Now that we have the icon, we need to create an action file and a description file to go with it.
Now it's time to modify the front panel to include the icon and action we just created. The front panel file, dtwm.fp , is located in the / usr/dt/appconfig/types/C directory. Because we don't want to overwrite the system file, we need to copy it locally and then modify it for our use.
A couple of things to remember when creating actions: first and foremost, make sure that the PUSH_ACTION and the file names are the same. That similarity is how they find each other. Make sure the that action file ends with .dt and make sure that the description file is executable. If any of these are wrong, the action either won't work or won't appear. To avoid a lot of typing, sometimes the easiest approach is just to copy an existing definition and insert it where you want your new control to be and then modify it. As you move down the list of control definitions, you're moving from left to right across the front panel (notice that the POSITION_HINTS value increases in each definition). So if you want your new control to be to the right of the date on the front panel, you insert the control on the line below "date" and add a POSITION_HINTS 3 line to your definition; if you wanted your new control to be to the left of "date," insert the control on the line above "date" with a POSITION_HINTS of 1. The new control definition can be located anywhere in the list of control definitions. The POSITION_HINTS line keeps it from getting inadvertently bumped to a new position. It's still a good idea to copy an existing definition and avoid extra typing; it reduces the chance of typing mistakes. And don't forget to include the curly braces. Using Different FontsAlthough CDE fonts have been carefully selected for readability, you may have valid reasons to prefer other fonts. To make your fonts available system-wide throughout the CDE environment, put them in /etc/dt/app-defaults/Dtstyle so that they will appear in the style manager's font dialog box. To make fonts available only for a particular X client application, specify the font in the app-defaults file for the application. Just remember, this overrides the fonts in the style manager. The font dialog box can contain a maximum of seven font sizes. You can adjust this number downward by resetting the value of Dtstyle*NumFonts in /etc/dt/app-defaults/Dtstyle ; however, you can't increase the number higher than seven. The Font Dialog section of the Dtstyle configuration file has seven SystemFont resources and seven UserFont resources. Again, you can have fewer than seven system and seven user fonts, but you can't have more. To specify fonts for a particular application, use the *FontList resource in the app-defaults file for the application. To modify font resources on an individual user basis, you can use the EditResources action as described in the earlier section "Changing the Front Panel in Other Ways." Changing the Login MessagesOne of the nice things about CDE is the ability to modify so many parts. You can customize individual login accounts or the entire system. By customizing the login screen, you can show those about to log in the name of the system they are accessing, the company logo, and a personalized greeting. These modifications take place in the Xresources file:
The first line is the message on the initial login screen. Let's change that so that it welcomes us to our company, ABC, Inc.:
Changing the Login PictureAdding a new picture to the login screen is easy if you know one thing. The file has to be a bitmap (.bm) or pixmap (.pm) file. A bitmap file is black and white, and the pixmap file is color. I've tried using other kinds of pictures (.gif and .jpg formats), but they just don't display. The good news is that these can be imported from other systems or the Internet for our use. To make things simple, we're going to use one already on the system. A bitmap showing a birthday cake was found in /usr/lib/X11/bitmaps on an HP-UX workstation. However, I have also successfully pulled down pictures of flowers, the Grand Canyon, and country music singers (note: Donna wrote this chapter, not Marty) from the Internet and put them on my system login screen.
Now that we've seen how easily we can make some simple customizations in CDE for our end-users, we should be able to take this knowledge and really make their CDE environments a productive and friendly place to work. |