The Session Manager

A session is the collection of applications, settings, and resources present on the user’s desktop. Session management is a set of conventions and protocols that let the Session Manager save and restore a user’s session. When users log in to the desktop for the first time, a default initial session is loaded. Afterward, users can log in to the system and see the same set of running applications, settings, and resources that were present when they last logged out.

Session Manager is responsible for starting the desktop and automatically saving and restoring running applications, colors, fonts, mouse behavior, audio volume, and keyboard clicks. Using Session Manager, you can do the following:

  • Customize the initial session for all desktop users

  • Customize the environment and resources for all desktop users

  • Change the session startup message

  • Change parameters for session startup tools and daemons

  • Customize desktop color usage for all users

Session Manager is started through /usr/dt/bin/Xsession. When the user logs in using Login Manager, Xsession is started by default. When Session Manager is started, it goes through the following steps to start the user’s session:

1.
Sources the .dtprofile script

2.
Sources the Xsession.d scripts

3.
Displays a welcome message

4.
Sets up desktop search paths

5.
Gathers available applications

6.
Optionally sources $HOME/.profile or $HOME/.login

7.
Starts the ToolTalk messaging daemon

8.
Loads session resources

9.
Starts the color server

10.
Starts the Workspace Manager

11.
Starts the session applications

Sourcing the $HOME/.dtprofile Script

At session startup, the Xsession script sources the user’s $HOME/.dtprofile script—a /bin/sh or /bin/ksh script that lets users set up environment variables for their sessions. .dtprofile accepts only sh or ksh syntax. The desktop default is /usr/dt/config/sys.dtprofile. If the $HOME/.dtprofile script does not exist (for example, when a user is logging in for the first time), Xsession copies the desktop default sys.dtprofile to $HOME/.dtprofile.

You can customize the sys.dtprofile script by copying it from /usr/dt/ config to /etc/dt/config and editing the new file. You can also set up personal environment variables in $HOME/.dtprofile. For example, export MYVARIABLE="value" sets the variable MYVARIABLE in the user’s environment at the next login.

To set system-wide environment variables, create a file in the /etc/dt/ config/Xsession.d directory that sets and exports the variable. For example, if you create an executable ksh script, /etc/dt/config/Xsession.d/sitevars, that contains export SITEVARIABLE="value", the variable SITEVARIABLE is set in each user’s environment at the next login.

Note

Although Session Manager does not automatically read the .profile or .login files, it can be configured to use these files. To tell Xsession to source the .profile or .login scripts, set the variable DTSOURCEPROFILE to true in $HOME/.dtprofile.


Sourcing the Xsession.d Scripts

After sourcing the $HOME/.dtprofile script, the Xsession script sources the Xsession.d scripts. These scripts set up additional environment variables and start optional daemons for the user’s session.

Caution

Errors in any of the session startup files could prevent a user from logging in. To troubleshoot session startup problems, check the file $HOME/.dt/startlog. Session Manager logs each user’s session startup progress in this file.


Customizing the Welcome Message

After sourcing /etc/dt/config/sys.dtprofile (if it exists), $HOME/.dtprofile, and the Xsession.d scripts, Xsession displays a welcome message that covers the screen. You can customize the welcome message or turn it off entirely.

The dthello client is used to display the welcome message. To alter the message text, change the dthello options by modifying the dtstart_hello[0] variable. To change dtstart_hello[0], create a /usr/dt/config/Xsession.d script that sets the new value. For example, to display the message of the day for all users, create an executable sh or ksh script called usr/dt/config/ Xsession.d/myvars and set dtstart_hello[0] as follows:

dtstart_hello[0]="/usr/dt/bin/dthello -file /etc/motd &" 

Users can also change the welcome message for their sessions by setting dtstart_hello[0] in $HOME/.dtprofile. To turn off the welcome message, set dtstart_hello[0]=" ".

Setting Desktop Search Paths

The desktop uses search paths, created at login, to locate applications and their associated desktop files. The desktop provides four search paths, which are described in Table 25.2.

Table 25.2. Desktop Search Paths
Search Path Description
Applications Used to locate applications. Application Manager uses the applications search path to dynamically populate its top level when a user logs in.
Database Used to specify additional locations for action- and data-type definition files (*.dt files) and Front Panel files (*.fp files).
Icons Used to specify additional locations for icons.
Help data Used to specify additional locations for desktop help data.

Modifying a Search Path

You may find it necessary to modify the search path for a particular user. The following steps describe how to modify the desktop search paths :

Exercise 25.1 Modifying a Search Path

To modify the search path for a particular user, follow these steps:

1.
Open $HOME/.dtprofile for editing.

2.
Add or edit a line that defines and exports the personal input variable.

For example, the following line adds a location to the user’s personal application search path:

export DTSPUSERAPPHOSTS=/projects1/editors 

3.
To make the change take effect, log out and then log back in.

Gathering Available Applications

After you set up the desktop search paths, the next step is to gather available applications by using dtappgather. These are the applications to be displayed in the Application Manager window. The dtappgather utility gathers application files for presentation by the Application Manager and is responsible for creating and refreshing the user’s Application Manager subdirectory.

To alter dtappgather’s command-line options, modify the dtstart_appgather variable either in the /etc/dt/config/Xsession.d/sitevars file for all users or in $HOME/.dtprofile for individual users. Set dtstart_appgather as follows:

dtstart_appgather="/usr/dt/bin/dtappgather &"

Sourcing a User .profile or .login File

Xsession will source a user’s traditional $HOME/.profile or $HOME/.login scripts, and by default this capability is enabled. This is accomplished by instructing Xsession to source the .profile or .login script by setting DTSOURCEPROFILE to true in $HOME/.dtprofile, as follows:

DTSOURCEPROFILE=true 

Starting the ToolTalk Messaging Daemon

The next task for Xsession is to start the ToolTalk messaging daemon. The ToolTalk service enables independent applications to communicate without having direct knowledge of each other. Applications create and send ToolTalk messages to communicate with each other. The ToolTalk service receives these messages, determines the recipients, and then delivers the messages to the appropriate applications. Users can change the ttsession options for their own sessions by setting the dtstart_ttsession variable in $HOME/.dtprofile as follows:

dtstart_ttsession="/usr/dt/bin/ttsession -s" 

Loading Session Resources

Resources are used by applications to set certain aspects of appearance and behavior. For example, the Style Manager (dtstyle) provides resources that enable you to specify where the system looks for files containing information about color palettes by entering the following line of information in the sys.resources file located in the /etc/dt/config/<language> directory:

Dtstyle*paletteDirectories: /usr/dt/palettes/C /$HOME/.dt/palettes 

Note

If the sys.resources file does not exist, it might need to be created using the instructions in the next paragraph.


The Session Manager loads resources at session startup. The desktop default resources can be found in /usr/dt/config/<language>/sys.resources. These resources are made available to each user’s session via the RESOURCE_MANAGER property. This file should not be edited because it is overwritten on subsequent desktop installations. The system administrator can modify the system default resources by creating /etc/dt/config/<language>/sys.resources. In this file, you can override default resources or specify additional resources for all desktop users. To set personal resources, make the entries in the $HOME/ .Xdefaults file.

Users can modify the desktop default and system-wide resources through their $HOME/.Xdefaults file. Resources specified in this file take precedence over those specified in the desktop default or system administrator resource files.

Starting the Color Server

You can choose a wide range of colors for your display either by using the Style Manager or by customizing the color resources used by the Style Manager to control desktop color usage. To access the Style Manager, click the Front Panel and select Style Manager, as shown in Figure 25.1. The Style Manager will appear as shown in Figure 25.2.

Figure 25.1. Click the Front Panel to access the Style Manager.


Figure 25.2. The Style Manager.


Set color server resources for all users by creating /etc/dt/config/<language>/ sys.resources and specifying the color server resources in that file. Users can similarly set these for their own sessions by specifying them in $HOME/ .Xdefaults.

Starting the Workspace Manager

The Session Manager is responsible for starting the Workspace Manager. By default, /usr/dt/bin/dtwm is started. The Workspace Manager is the window manager provided by the desktop. It controls the following:

  • The appearance of window frame components

  • The behavior of windows, including their stacking order and focus behavior

  • Key bindings and button bindings

  • The appearance of minimized windows

  • Workspace and window menus

In addition, the Workspace Manager controls the desktop components outlined in Table 25.3.

Table 25.3. Desktop Components
Component Description
Workspaces The Workspace Manager controls the number of workspaces and keeps track of which windows are open in each workspace.
Workspace backdrops The user can change the backdrop image by using the Style Manager. Backdrop management, however, is a function of the Workspace Manager.
The Front Panel Although the Front Panel uses its own configuration files, it is created and managed by the Workspace Manager.

Additional modifications that can be made to the Workspace Manager include changing the number of workspaces and providing system-wide workspace names.

Changing the Number of Workspaces on a System-Wide Basis

The default desktop configuration provides four workspaces. The user can add, delete, and rename workspaces by using the pop-up menu associated with the workspace switch.

In the /usr/dt/app-defaults/C/Dtwm file, the workspaceCount resource is set to the following default number of workspaces:

Dtwm*0*workspaceCount: 4 
Dtwm*workspaceCount: 4 

Multiple workspaces are specified on screen 0; a single workspace is specified on any other screen. You can create the /etc/dt/config/C/sys.resources file (or modify it if it already exists) to change the default number of workspaces for all new users on a workstation.

Use the Dtwm*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 

Providing System-Wide Workspace Names

Internally, the workspaces are numbered by the numbering convention ws<n>, in which 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 in the Dtwm file described earlier:

Dtwm*wsn*title: name
							

For example, the following resources set the default four workspaces to the specified names:

Dtwm*ws0*title: Glenda 
Dtwm*ws1*title: Neil 
Dtwm*ws2*title: Nicole 
Dtwm*ws3*title: William 

Starting the Session Applications

At session startup, the Session Manager restarts any applications saved in the previous session. The system default set of applications to be restored as part of the user’s initial session can be found in /usr/dt/config/<language>/ sys.session. Do not edit this file.

A system administrator can replace the set of applications started as part of the user’s initial session by copying /usr/dt/config/<language>/sys.session to /etc/dt/config/<language>/sys.session and modifying the latter file. Unlike the resource files, this file is used as a complete replacement for the desktop default file.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset