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

Chapter 14 Creating Icons for the Desktop

Desktop icons are associated with:


Note –

The development environment documentation contains additional information about desktop icons. See Chapter 4, “Visual Design,” in theCommon Desktop Environment: Style Guide and Certification Checklist.


Icon Image Files

For the desktop to use an icon image, the icon image file must:

Icon File Formats

For a color display, use X pixmap (XPM) format icon files, which typically have a.pm suffix. Otherwise, use X bitmap (XBM) format files, which typically have a .bm suffix. If transparency is used in the pixmap file, a mask file (_m.bm) is generated when the .bm file is created. See Icon Search Path for more information about how the desktop finds these files.

Icon File Names

Each icon and backdrop image is stored as a separate file. Typically, an icon is specified with the base part of its file name. For example, an icon might be referenced with the name mail when the file is actually stored as:

/usr/dt/appconfig/icons/language/mail.l.pm

The file-naming convention of adding suffixes helps group icons by size and type. Icon names for desktop components are in these general formats:

basename.size.format

Or

basename.format

where:

basename—the image base name used to reference the image

size—a letter indicating the size: l (large) m (medium) s (small) t (tiny)

format—file format: pm (pixmap) bm (bitmap)

Icon Size Conventions

Table 14–1shows the recommended pixel dimensions for desktop icons.

Table 14–1 Icon Sizes and File Names

Icon Size 

Bitmap Name 

Pixmap Name 

16 by 16 (tiny) 

name.t.bm

name.t.pm

24 by 24 (small) 

name.s.bm

name.s.pm

32 by 32 (medium) 

name.m.bm

name.m.pm

48 by 48 (large) 

name.l.bm

name.l.pm

Table 14–2 shows the icon sizes used by the desktop components. In some cases, the size of the icon used depends on the display resolution.

Table 14–2 Desktop Components and Their Icon Sizes

Desktop Component 

High Resolution 

Medium Resolution 

Low Resolution 

File Manager and Application Manager (View by Name and Icon) 

medium 

medium 

medium 

File Manager and Application Manager (View by Name and Small Icon) 

tiny 

tiny 

tiny 

Main Front Panel controls 

large 

large 

medium 

Front Panel subpanels 

medium 

medium 

tiny 

Front Panel switch controls 

small 

small 

tiny 

Minimized windows 

large 

large 

medium 

For example, if you specify an icon named mail for a data type, have a color display, and have set the File Manager preferences to small icons, the icon image used is mail.t.pm.

Icon Search Path

The desktop finds an icon file, or image, by searching for the file in a list of directories. This list of directories, called the icon search path, is determined by the value of several environment variables. Which variables are used and how they are put together to create the icon search path are discussed in Icon Search Path.

The default search path is:

Accessing Icons across the Network

The desktop can access icons on remote systems. For information on creating an icon server, see Configuring Database, Icon, and Help Services.

Icon Associations

To enable quicker object recognition, you can associate icons with:

Specifying Icon Files

For icons used for actions, data types, and in the Front Panel or subpanels, specify only the base name of the icon (no suffixes). The correct suffixes are added automatically based on your display resolution, color support, and File Manager view options (such as By Small Icons).

To override the search path, provide the complete path and name of the icon.

To Associate an Icon with an Action or Data Type

  1. Specify the icon using the ICON field.

    If you follow the appropriate naming conventions for icon files, specify only the base name of the icon. The correct icon will be displayed based on the resolution and color support of your display.

  2. Create the following icon sizes:

    • Actions: large, medium, and tiny

    • Data types: medium and tiny

Example of an Action Definition

The following example is an action definition for starting the Island Paint drawing tool. The icons Ipaint.l and Ipaint.s are associated with the action.

ACTION	IslandPaintOpenDoc
{
 	WINDOW_TYPE				NO-STDIO
 	ICON						Ipaint
 	EXEC_STRING    		/usr/bin/IslandPaint %Arg_1"File to open:"%
 }

If you are using color icons, the desktop first appends .pm when looking for the actual icon files. Otherwise (or if no match is found with .pm), the desktop appends .bm.

Example of Data Type Definition

The following data type definition associates the icons comprsd.l and comprsd.s with compressed files:

DATA_ATTRIBUTES  COMPRESSED
{
		ICON					comprsd
 	ACTIONS				Uncompress
 	DESCRIPTION			A COMPRESSED file has been compressed by the \
 							'compress' command to take up less space.
} 

To Display an Icon in a Front Panel Control

  1. Specify the image name using the ICON field.

    If the control monitors a file (MONITOR_TYPE is set to mail or file), use the ALTERNATE_ICON field to specify the icons used when the change is detected.

    You can also provide animation for buttons and drop zone controls.

  2. Create the following icon sizes:

    • Front Panel and subpanels: large, medium, and tiny

    • Workspace switch: small

Example

The following control changes appearance when a file named report is placed in the /doc/ftp/pub/ directory. When the file is not there, the NoReport.pm icon is displayed; when the file is there, Report.pm is displayed.

CONTROL MonitorReport
 {
 	CONTAINER_NAME				container_name
 	TYPE							ICON
     MONITOR_TYPE				file
 	FILE_NAME					/doc/ftp/pub/report
 	ICON							NoReport
 	ALTERNATE_ICON				Report
 }

To Associate an Icon with an Application Window

  1. Set the iconImage resource for Workspace Manager as follows:

    Dtwm*clientname*iconImage: icon_file_name

    To determine the correct value for clientname, open Application Manager and double-click Window Properties in the Desktop_Tools application group. When you select a window, its properties are listed. The WM_CLASS property displays the window's class name in quotes.

    For more information about setting resources, see Setting Application Resources.

  2. Choose Restart Workspace Manager from the Workspace menu.

    To verify that the icon has been recognized by Workspace Manager, minimize the window whose icon you are trying to modify.


    Note –

    Some applications do not allow their default window icon to be overridden.


To Use File Manager as an Icon Browser

  1. Copy the file /usr/dt/examples/language/IconBrowse.dt to the HomeDirectory/.dt/types/Iconbrowse.dt directory.

  2. Open Application Manager and double-click Reload Actions in the Desktop_Tools application group.

    When you change to a directory that contains icons (.bm and .pm files), each icon is displayed next to its name. For example, if you change to the /usr/dt/appconfig/icons/language directory, you will see many of the desktop icons.


    Note –

    Enabling icon browsing on low-memory systems may cause File Manager to display directories more slowly. Images larger than 256 x 256 are not displayed in the default configuration.


    To disable icon browsing:

  1. Remove your personal copy of the IconBrowse.dt file.

  2. Open Application Manager and double-click Reload Actions in the Desktop_Tools application group.

Icon Design Recommendations

Use a common theme among related icons. For example, if you are designing icons for an application, have purposeful similarities between the application's icon and icons for data files.

Be sure the two-color version of any color icon you design is acceptable. If the icon is displayed on a monochrome or grayscale display (or if there are not enough colors available), the icon is automatically displayed in its two-color form.

To conserve system color usage, try to limit icon color use to the colors provided by the desktop. (Icons created using Icon Editor will be use only desktop colors.)

For the sizes used by the desktop components, see Table 14–1.

Color Usage

Desktop icons use a palette of 22 colors including: