Configuring Session Manager Session Manager is responsible for starting the desktop and automatically saving and restoring running applications, colors, fonts, mouse behavior, audio volume, and keyboard click. Using Session Manager, you can: 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 What Is a Session?<IndexTerm><Primary>Session Manager</Primary><Secondary>introduction</Secondary></IndexTerm><IndexTerm><Primary>session</Primary><Secondary>definition</Secondary></IndexTerm> 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 enables Session Manager to save and restore a user's session. A user is able to log into the system and be presented with the same set of running applications, settings, and resources as were present when the user logged off. When a user logs into the desktop for the first time, a default initial session is loaded. Afterward, Session Manager supports the notion of a current and a home session.sessiondefaultcurrent sessionsessioncurrentsessionhomehome session The Initial Session<IndexTerm><Primary>session</Primary><Secondary>default</Secondary></IndexTerm><IndexTerm><Primary>session</Primary><Secondary>initial</Secondary></IndexTerm> When a user logs into the desktop for the first time, Session Manager will generate the user's initial session using system default values. By default, the File Manager and Information Manager will start. The Information Manager displays introductory information about the CDE desktop. Current Session<IndexTerm><Primary>session</Primary><Secondary>current</Secondary></IndexTerm><IndexTerm><Primary>current session</Primary></IndexTerm> The user's running session is always considered the current session, whether restored upon login from a saved home session, a saved current session, or the system default initial session. Based on the user's Style Manager Startup settings, when the user exits the session, Session Manager automatically saves the current session. When the user next logs in to the desktop, Session Manager restarts the previously saved current session, meaning that the desktop will be restored to the same state as when the user last logged out. Home Session<IndexTerm><Primary>session</Primary><Secondary>home</Secondary></IndexTerm><IndexTerm><Primary>home session</Primary></IndexTerm> You can also have the desktop restored to the same state every time the user logs in, regardless of its state when the user logged out. The user can save the state of the current session and then, using the Style Manager Startup settings, have Session Manager start that session every time the user logs in. Display-Specific Sessions<IndexTerm><Primary>session</Primary><Secondary>display-specific</Secondary></IndexTerm> To run a specific session for a specific display, a user can create a display- specific session. To do this, the user can copy the HomeDirectory/.dt/sessions directory to HomeDirectory/.dt/display, where display is the real, unqualified host name (for example, pablo:0 is valid, pablo.gato.com:0 or unix:0 is not). When the user logs in on display pablo:0, Session Manager will start that display-specific session. Starting a Session<IndexTerm><Primary>session</Primary><Secondary>starting</Secondary></IndexTerm><IndexTerm><Primary>Session Manager</Primary><Secondary>starting</Secondary></IndexTerm><IndexTerm><Primary>Session Manager</Primary><Secondary>See also, session</Secondary></IndexTerm> Session Manager is started through /usr/dt/bin/ Xsession file starting Session Manager Xsession. When the user logs in using the Login Manager, Xsession is started by default. Optionally, the user can log in using the traditional character mode getty (getty) login, and start Session Manager manually using tools that start an X server, such as xinit. For example: xinit /usr/dt/bin/Xsession. When a Session Starts When Session Manager is started, it goes through the following steps to start the user's session: Sources the HomeDirectory .dtprofile file sourcing in /.dtprofile script Sources the Xsession.d directory Xsession.d scripts Displays a Session Manager welcome message welcome message displaying welcome message Sets up desktop search paths desktop search paths Gathers available applications Optionally sources HomeDirectory .profile file[profile file] /.profile or HomeDirectory .login file[login file] /.login Starts the ToolTalk messaging daemon ToolTalk® messaging daemon Loads session resources resources session session resources Starts the color server color server Starts the Workspace Manager starting Workspace Manager Starts the session applications starting at login applications The following sections describe the steps listed above. Sourcing the .dtprofile Script<IndexTerm><Primary>.dtprofile file</Primary><Secondary>sourcing in</Secondary></IndexTerm> At session startup, the Xsession file Xsession script sources the user's HomeDirectory environment variables in .dtprofile /.dtprofile script. The HomeDirectory/.dtprofile script is a /bin/sh or /bin/ksh script that enables users to set up environment variables in .dtprofile environment variables for their sessions. For more information on setting up environment variables, see . If the HomeDirectory/.dtprofile script does not exist, such as when a user is logging into the desktop for the first time, Xsession will copy the desktop default sys.dtprofile to shell personal customization HomeDirectory .dtprofile file creating /.dtprofile. environment variables default The desktop default is /usr/dt/config/sys.dtprofile sys.dtprofile file . To customize the shell system-wide customization sys.dtprofile script, copy sys.dtprofile from /usr/dt/config to /etc/dt/config and edit the new file. Sourcing Xsession.d Scripts<IndexTerm><Primary>Xsession.d directory</Primary><Secondary>scripts in</Secondary></IndexTerm> After sourcing the HomeDirectory/.dtprofile script, the Xsession script sources the Xsession.d scripts. These scripts are used to set up additional environment variables and start optional daemons for the user's session. The default Xsession.d scripts are: 0010.dtpaths Documents customizable desktop search paths 0020.dtims Starts optional input method server 0030.dttmpdir Creates per-user, per-session temporary directory 0040.xmbind Sets up $XMBINDDIR to desktop default There may be additional vendor-specific scripts in Xsession.d. Xsession first sources all files in the /usr/dt/config/Xsession.d directory, followed by those in the /etc/dt/config/Xsession.d directory. The desktop default Xsession.d scripts are located in the /usr/dt/config/Xsession.d directory. To customize an Xsession.d script, copy the script from /usr/dt/config/Xsession.d to /etc/dt/config/Xsession.d and edit the new file. You must have execute permission to perform this task.Xsession.d directorycustomizing Also, to have Xsession automatically source a script of your own, copy it to /etc/dt/config/Xsession.d.Xsession filesystem-wide customizationSession Managersystem-wide customization When you modify or create an Xsession.d script, make sure that any foreground commands you issue are of short duration, as the time taken by the command will directly affect session startup time. If a foreground command does not exit, the session startup will hang. Commands run in an Xsession.d script that you want to remain running for the duration of the session should be run in the background. <IndexTerm><Primary>welcome message</Primary><Secondary>displaying</Secondary></IndexTerm>Displaying the Welcome Message After sourcing HomeDirectory/.dtprofile and the Xsession.d scripts, Xsession displays a welcome message that covers the screen. You can customize the welcome message displayed, or turn off the message entirely. The dthello client is used to display the message. welcome message customizing To alter the message text, change the dthello options by modifying the dtstart_hello[0] variable. To change dtstart_hello[0], create an /etc/dt/config/Xsession.d script that sets the new value. To display the message of the day for all users, create an executable sh or ksh script, for example /etc/dt/config/Xsession.d/myvars, and set dtstart_hello[0] as follows: dtstart_hello[0]=“/usr/dt/bin/dthello -file /etc/motd &“ Similarly, users can change the welcome message for their sessions by setting dtstart_hello[0] in HomeDirectory/.dtprofile. To turn off the welcome message, set dtstart_hello[0]=“ “. For more information about dthello, see the dthello man page. Setting Up the Desktop Search Paths<IndexTerm><Primary>Session Manager</Primary><Secondary>setting search paths</Secondary></IndexTerm><IndexTerm><Primary>search paths</Primary><Secondary>set by Session Manager</Secondary></IndexTerm> The desktop search paths are created at login by dtsearchpath dtsearchpath. There are two categories of environment variables used by dtsearchpath: Input Variables System-wide and personal environment variables whose values are set by the system administrator or end user. Output Variables Variables created and assigned values by dtsearchpath. The value of each variable is the search path for the desktop session. To alter the command-line options of dtsearchpath, modify the dtstart_searchpath variable. To change the dtstart_searchpath variable dtstart_searchpath variable for all users, create an executable sh or ksh script (for example /etc/dt/config/Xsession.d/myvars), and set dtstart_searchpath as follows: dtstart_searchpath=“/usr/dt/bin/dtsearchpath“ Users can similarly change the dtsearchpath options for their own sessions only by setting dtstart_searchpath in HomeDirectory/.dtprofile. For more information about dtsearchpath, see . For more information about dtsearchpath options, see the dtsearchpath man page. Gathering Available Applications The next step after setting up the desktop search paths is to gather available applications, using dtappgather. To alter the command-line options of Application Manager gathering applications Session Manager gathering applications applications gathered by Session Manager dtappgather dtappgather, modify the dtstart_appgather variable. To change the dtstart_appgather variable dtstart_appgather variable for all users, create an executable sh or ksh script (for example /etc/dt/config/Xsession.d/myvars), and set dtstart_appgather as follows: dtstart_appgather=“/usr/dt/bin/dtappgather &“ Users can similarly change the dtappgather options for their own sessions only by setting dtstart_appgather in HomeDirectory/.dtprofile. For more information about dtappgather options, see the dtappgather (4) man page. Optionally Sourcing the .profile or .login Script<IndexTerm><Primary>environment variables</Primary><Secondary>sourcing in .login or .profile</Secondary></IndexTerm><IndexTerm><Primary>shell</Primary><Secondary>sourcing in .profile or .login</Secondary></IndexTerm><IndexTerm><Primary>.profile file</Primary><Secondary>sourcing in</Secondary></IndexTerm><IndexTerm><Primary>.login file</Primary><Secondary>sourcing in</Secondary></IndexTerm> Xsession is able to source a user's traditional HomeDirectory/.profile or HomeDirectory/.login scripts. By default this capability is disabled. To tell Xsession to source the .profile or .login script, set DTSOURCEPROFILE variable DTSOURCEPROFILE to true. To change DTSOURCEPROFILE for all users, create an /etc/dt/config/Xsession.d script that sets the new value. To set DTSOURCEPROFILE to true for all users, create an executable sh or ksh script, for example /etc/dt/config/Xsession.d/myvars, and set DTSOURCEPROFILE as follows: DTSOURCEPROFILE=true Users can similarly change DTSOURCEPROFILE for their own sessions by setting DTSOURCEPROFILE to true in HomeDirectory/.dtprofile. Starting the ToolTalk Messaging Daemon<IndexTerm><Primary>ToolTalk</Primary><Secondary>messaging daemon</Secondary></IndexTerm> The ToolTalk messaging daemon, ttsession, enables independent applications to communicate with each other without having direct knowledge of each other. Applications create and send ToolTalk messages to communicate with each other. ttsession communicates on the network to deliver messages. To alter the command-line options of ttsession starting ttsession, modify the dtstart_ttsession variable. To change the dtstart_ttsession variable dtstart_ttsession variable for all users, create an executable sh or ksh script (for example /etc/dt/config/Xsession.d/myvars), and set dtstart_ttsession as follows: dtstart_ttsession=“/usr/dt/bin/ttsession -s“ Users can similarly change the ttsession options for their own sessions by setting dtstart_ttsession in HomeDirectory/.dtprofile. For more information about ttsession options, see the ttsession man page. For more information on ttsession, see Getting Started Using ToolTalk Messaging. Starting the Session Manager Client<IndexTerm><Primary>Session Manager</Primary><Secondary>client</Secondary></IndexTerm> At this point, Xsession starts /usr/dt/bin/dtsession, which continues the session startup process. Loading the Session Resources<IndexTerm><Primary>Session Manager</Primary><Secondary>loading resources</Secondary></IndexTerm><IndexTerm><Primary>resources</Primary><Secondary>loading</Secondary></IndexTerm> Session Manager uses the X server RESOURCE_MANAGER property to make desktop resources available to all applications. Session Manager loads the RESOURCE_MANAGER by: Loading the system default resources Merging any system-wide resources specified by the system administrator. Merging any user-specified resources The desktop default resources can be found in /usr/dt/config/language sys.resources file resources default desktop /sys.resources. These resources will be made available to each user's session via the RESOURCE_MANAGER property. This file should not be edited, as it is overwritten upon subsequent desktop installations. You can augment the system default resources by creating /etc/dt/config/language sys.resources file /sys.resources. In this file, you can override default resources or specify additional resources for all desktop users. Since this file is merged into the desktop default resources during session startup, only new or updated resource specifications should be placed in this file. Resources specified in this file will be made available to each user's session through the RESOURCE_MANAGER property. Resources specified in this file take precedence over those specified in the desktop default resource file. Users can augment the desktop default and system-wide resources using their HomeDirectory/.Xdefaults file. Resources specified in this file will be made available to that user's session through the RESOURCE_MANAGER property. Resources specified in this file take precedence over those specified in the desktop default or system administrator resource files. The X Toolkit Intrinsics utility specifies that it will load resources for an application from either RESOURCE_MANAGER property RESOURCE_MANAGER or from HomeDirectory/.Xdefaults, but not both. Ordinarily, this would mean that the user's HomeDirectory/.Xdefaults file would be ignored. However, Session Manager accommodates HomeDirectory/ .Xdefaults file[Xdefaults file] .Xdefaults by merging it into the RESOURCE_MANAGER at session startup as described above. If a user changes HomeDirectory/.Xdefaults, the changes will not be visible to new applications until the user invokes the Reload Resources action. The Reload Resources action Reload Resources action will instruct Session Manager to reload the RESOURCE_MANAGER with the default, system-wide, and user-specified resources. This makes changes to the system-wide and personal resource files available to applications. For more information see: The dtresourcesfile(4)man page Starting the Color Server<IndexTerm><Primary>color server</Primary><Secondary>starting</Secondary></IndexTerm> Session Manager serves as the color server resources color server for the desktop and provides the following set of dtsession resources that can be used to configure it. foregroundColorforegroundColor resource Controls whether a pixel is allocated for the foreground color dynamicColordynamicColor resource Specifies whether read-only colors are allocated shadowPixmapsshadowPixmaps resource Specifies whether colors are allocated for top shadow or bottom shadow colorUsecolorUse resource Limits color allocation writeXrdbColorswriteXrdbColors resource Specifies whether the *background and *foreground resources are placed in the resource database You can 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 color server resources for their own sessions by specifying color server resources in HomeDirectory/.Xdefaults. For more information about setting color server resources, see . Starting Workspace Manager<IndexTerm><Primary>Workspace Manager</Primary><Secondary>starting</Secondary></IndexTerm><IndexTerm><Primary>Session Manager</Primary><Secondary>starting Workspace Manager</Secondary></IndexTerm> Session Manager is responsible for starting Workspace Manager. By default /usr/dt/bin/ Workspace Manager starting dtwm is started. An alternate window manager can be specified with the wmStartupCommand resource Window Manager changing wmStartupCommand resource. You can specify an alternate window manager for all users by creating /etc/dt/config/language/sys.resources and specifying the full path name and options for the window manager with the Dtsession*wmStartupCommand resource in that file. Users can similarly specify an alternate window manager for their own sessions only by specifying the Dtsession*wmStartupCommand resource in HomeDirectory/.Xdefaults. For more information about the Window Manager, see . Starting the Session Applications<IndexTerm><Primary>applications</Primary><Secondary>starting at login</Secondary></IndexTerm><IndexTerm><Primary>Session Manager</Primary><Secondary>starting applications</Secondary></IndexTerm> At session startup, Session Manager will restart any applications that were saved as part of the 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. This file should not be edited as it will be unconditionally overwritten upon subsequent desktop installations. For more information, see the dtsessionfile(4) and dtsessiondb(4) man pages.sys.session file A system administrator can replace the set of applications that are 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 will be used as a complete replacement for the desktop default file, so you can make a copy of the system default file and make any necessary modifications.Session Managercustomizing application startup Additional Session Startup Customizations This section covers: Setting environment variables Setting resources Using display-dependent sessions Running scripts at login Recovering a back-up session To Set Environment Variables<IndexTerm><Primary>environment variables</Primary><Secondary>setting</Secondary></IndexTerm><IndexTerm><Primary>variables</Primary><Secondary>environment, See environment variables</Secondary></IndexTerm> environment variables system-wide To set system-wide environment variables, create a file in the /etc/dt/config/Xsession.d Xsession.d directory directory that sets and environment variables exporting exports the variable. For example, if you create an executable sh or ksh script, /etc/dt/config/Xsession.d/myvars, containing: export MYVARIABLE=“value then the variable MYVARIABLE will be set in each user's environment at the next login. environment variables personal To set personal environment variables, set the variable in HomeDirectory .dtprofile file setting environment variables in /.dtprofile. For example: export MYVARIABLE=“value sets the variable MYVARIABLE in each user's environment at the next login. Session Manager does not automatically read the .profile file not read by Login Manager .profile or .login file not read by Login Manager <$nopage>shell See also environment variables, .profile, .login, .dtprofile .login file. However, it can be configured to use these files; see . To Set Resources<IndexTerm><Primary>resources</Primary><Secondary>setting</Secondary></IndexTerm> To set system-wide resources, add the resources to the file /etc/dt/config/language/sys.resources. (You may have to create the file.)sys.resources file . .dtprofile file syntax dtprofile only supports /bin/sh or /bin/ksh syntax. For example, if in /etc/dt/config/C/sys.resources you specify: AnApplication*resource: value then the resource AnApplication*resource will be set in each user's RESOURCE_MANAGER property at the next login.RESOURCE_MANAGER property To set personal resources, add the resources to the file HomeDirectory/.Xdefaults. To Set Display-Specific Resources<IndexTerm><Primary>display-specific resources</Primary></IndexTerm><IndexTerm><Primary>resources</Primary><Secondary>display-specific</Secondary></IndexTerm> You can set display-specific resources for all desktop users on the system. Also, users can set display-specific resources limited to their own session. This enables you to specify resources depending upon which display the user uses to log in to the desktop. To set display-specific resources for all desktop users on the system, create the file /etc/dt/config/language/sys.resources that specifies the display-specific resources. To set personal display-specific resources, specify the resource in HomeDirectory/.Xdefaults. You delimit these resources by enclosing them in cpp statements cpp conditional statements. A DISPLAY_displayname macro DISPLAY_displayname macro is defined depending upon the value of the $DISPLAY variable. This is done by converting all. (period) and: (colon) characters to _ (underscores), stripping off any screen specification, and finally prefixing DISPLAY_ to the result. For example, a $DISPLAY of :0 would be DISPLAY_0, and a $DISPLAY of blanco.gato.com:0.0 would be DISPLAY_blanco_gato_com_0. The resulting value can be used as part of a cpp test in a session resource file. For example, if in /etc/dt/config/C/sys.resources you specify: Myapp*resource: value #ifdef DISPLAY_blanco_gato_com_0 Myapp*resource: specialvalue1 #endif #ifdef DISPLAY_pablo_gato_com_0 Myapp*resource: specialvalue2 #endif the resource MyApp*resource will be set in RESOURCE_MANAGER to specialvalue1 when the user logs in on display blanco.gato.com:0; specialvalue2 when the user logs in on pablo.gato.com:0; and value when the user logs in on another display. To Change Applications for the Initial Session<IndexTerm><Primary>session</Primary><Secondary>first</Secondary></IndexTerm> You can specify alternate applications to start as part of a user's initial session. Copy /usr/dt/config/language/sys.session to /etc/dt/config/language/sys.session. Modify the new sys.session file sys.session file. Each entry in sys.session appears as: dtsmcmd -cmd command_and_options dtsmcmd command To start an additional application as part of a user's initial session, specify a new sys.session entry with a full path name. For example, to start /usr/bin/X11/xclock as part of a user's initial session, add an xclock entry to /etc/dt/config/C/sys.resources: # # Start up xclock... # dtsmcmd -cmd “/usr/bin/X11/xclock -digital“ To Set Up a Display-Specific Session<IndexTerm><Primary>session</Primary><Secondary>display-specific</Secondary></IndexTerm><IndexTerm><Primary>display-specific session</Primary></IndexTerm> A user can set up a display-specific session to tune a session to a particular display. Copy the HomeDirectory/.dt/ sessions directory sessions directory to HomeDirectory/.dt/display where display is the real, unqualified host name (pablo:0 is valid, pablo.gato.com:0 or unix:0 is not). For example, to create a display-specific session for display pablo.gato.com:0: cp -r HomeDirectory/.dt/sessions HomeDirectory/.dt/pablo:0 When the user next logs in on display pablo.gato.com:0, the Session Manager will start that display-specific session. Executing Additional Commands at Session Startup and Logout Users can specify that additional commands be started when they log in to their desktop sessions. This is useful for setting up X settings that are not saved by Session Manager. For example, the user can use xsetroot to customize the root (workspace) pointer. Another use would be to start applications that are unable to be saved and restored by Session Manager. If an application will not restart when the session is restored, the user can start the client using this method. To Execute Additional Commands at Session Startup<IndexTerm><Primary>Session Manager</Primary><Secondary>executing additional commands</Secondary></IndexTerm><IndexTerm><Primary>session</Primary><Secondary>executing commands at startup</Secondary></IndexTerm> Create the file HomeDirectory/.dt/sessions/sessionetc containing the commands.sessionetc file Generally this file is a script and must have execute permission. Processes started in sessionetc should be run in the background. Do not use sessionetc to start clients that are automatically restored by Session Manager. Doing so can cause multiple copies of the application to be started. You may not be able to see the copies immediately because the windows may be stacked on top of one another. To Execute Additional Commands at Logout<IndexTerm><Primary>session</Primary><Secondary>executing commands at logout</Secondary></IndexTerm><IndexTerm><Primary>Session Manager</Primary><Secondary>executing commands at logout</Secondary></IndexTerm> A companion file to sessionetc is sessionexit file sessionexit. Use sessionexit to perform some operation at session exit that is not handled by Session Manager. Create the file HomeDirectory/.dt/sessions/sessionexit. Like sessionetc, this file is usually a script with execute permission. To Recover a Session from Backup<IndexTerm><Primary>session</Primary><Secondary>recovering</Secondary></IndexTerm><IndexTerm><Primary>Session Manager</Primary><Secondary>backing up sessions</Secondary></IndexTerm><IndexTerm><Primary>session</Primary><Secondary>backup</Secondary></IndexTerm> When Session Manager saves a session, the session information is stored in the HomeDirectory/.dt/sessions directory or in the HomeDirectory/.dt/display directory if using a display-specific session. In these directories, Session Manager creates a subdirectory named current or home to store information for the respective current or home session. Before the session information is stored, Session Manager makes a backup of the prior session with that name and stores it in current.old directory current.old or home.old directory home.old. Log in using the Failsafe Session or Command Line Login from the login screen. Copy the backup session directory to the active name. For example, to recover the backup home session: cp -r HomeDirectory/.dt/sessions/home.old HomeDirectory/.dt/sessions/home Display-specific sessions can be recovered in the same manner. To Investigate Session Startup Problems<IndexTerm><Primary>Session Manager</Primary><Secondary>error log</Secondary></IndexTerm><IndexTerm><Primary>Session Manager</Primary><Secondary>troubleshooting</Secondary></IndexTerm> Check the file HomeDirectory/.dt/startlog.startlog filesessionlogging errors The startlog file will contain the output (stderr) from applications started by the Session Manager (on the Session Manager's host). Session Manager Files and Directories<IndexTerm><Primary>configuration files</Primary><Secondary>Session Manager</Secondary></IndexTerm><IndexTerm><Primary>Session Manager</Primary><Secondary>files</Secondary></IndexTerm><IndexTerm><Primary>Session Manager</Primary><Secondary>directories</Secondary></IndexTerm> /usr/dt/bin/Xsession /usr/dt/config/Xsession.d/* /usr/dt/bin/dtsession /usr/dt/bin/dtsession_res HomeDirectory/.dt/sessions/current HomeDirectory/.dt/sessions/home HomeDirectory/.dt/display/current HomeDirectory/.dt/display/home