<chapter id="sessions">
  <title>Desktop Sessions</title>

  <!-- Maintained for 2.8 compatibility -->
  <anchor id="gosgetstarted-1"/>

  <remark>Needs better intro</remark>
  <remark>This chapter needs work</remark>

  <highlights>
    <para>This chapter provides the information you need to log in to and shut down MATE, and to start, manage, and end a desktop session.</para>
  </highlights>

  <sect1 id="gosgetstarted-69">
    <title>Starting a Session</title>
    <indexterm>
      <primary>sessions</primary>
      <secondary>starting</secondary>
    </indexterm>
    <para>A <firstterm>session</firstterm> is the period of time you spend using MATE, between logging in and logging out. During a session, you use your applications, print, browse the web, and so on.</para>
    <para>Logging in to MATE begins your session. The login screen is your gateway to the MATE Desktop: it is where you enter your username and password and select options such as the language you want MATE to use for your session.</para>
    <tip><para>
    Normally, logging out ends the session, but you can choose to save the state of your session and restore it next time you use MATE: see <xref linkend="gosstartsession-2"/>.</para></tip>
    
    <!--
    2.14 has moved all this out of the standard dialogs.
    
    The session manager saves and restores the following: 
    <itemizedlist>
      <listitem>
        <para>The appearance and behavior settings, for example fonts, colors,
and mouse settings. </para>
      </listitem>
      <listitem>
        <para>The applications that you were running, for example file manager
and text editor windows. You cannot save and restore applications that the
session manager does not manage. For example, if you start the <application>vi</application> editor from the command line in a terminal window, session
manager cannot restore your editing session. </para>
      </listitem>
    </itemizedlist>
    -->
    
    
    <sect2 id="gosstartsession-85">
      <title>Logging in to MATE</title>
      <indexterm>
        <primary>sessions</primary>
        <secondary>logging in</secondary>
      </indexterm>
      <indexterm>
        <primary>logging in</primary>
        <secondary>to session</secondary>
      </indexterm>
      <indexterm>
        <primary>start session</primary>
      </indexterm>
      <para>To log in to a session, perform the following steps:</para>
      <orderedlist>
        <listitem>
          <para>On the login screen, click on the <guilabel>Session</guilabel>
icon. Choose the MATE Desktop from the list of available desktop environments. 
Most users will not need to perform this step, as MATE is usually the default 
desktop environment already.</para>
        </listitem>
        <listitem>
          <para>Enter your username in the <guilabel>Username</guilabel> field
on the login screen, then press <keycap>Return</keycap>.</para>
        </listitem>
        <listitem>
          <para>Enter your password in the <guilabel>Password</guilabel> field
on the login screen, then press <keycap>Return</keycap>.</para>
        </listitem>
      </orderedlist>
      <para>When you log in successfully, MATE will take a short amount of time to start up. When it is ready, you will see the Desktop and you can begin using your computer.</para>
      <para>The first time you log in, the session manager starts a new
session. If you have logged in before and saved the settings for the previous 
session when you logged out, then the session manager restores your
previous session.</para>
      <para>If you want to shut down or restart the system before you log in, click
on the <guilabel>System</guilabel> icon on the login screen. A dialog is displayed.
Select the option that you require, then click <guibutton>OK</guibutton>.</para>
      <para>Your system distributor or vendor may have altered the login screen 
      so that it no longer has a <guilabel>System</guilabel> icon. In this case, 
      the option to shut down the computer may be found by clicking the 
      <guilabel>Other</guilabel> icon, or by clicking a separate 
      <guibutton>Shut Down</guibutton> button.</para>
<!--What about failsafe mate?-->
    </sect2>
    <sect2 id="gosstartsession-86">
      <title>Using a Different Language</title>
      <indexterm>
        <primary>sessions</primary>
        <secondary>different language, logging
in</secondary>
      </indexterm>
      <indexterm>
        <primary>language, logging in in different</primary>
      </indexterm>
      <indexterm>
        <primary>logging in</primary>
        <secondary>to session in different language</secondary>
      </indexterm>
      <para>To log in to
a session in a different language, perform the following actions.</para>
      <orderedlist>
        <listitem>
          <para>On the login screen, click on the <guilabel>Language</guilabel>
icon. Choose the language you require from the list of available languages.</para>
        </listitem>
        <listitem>
          <para>Enter your username in the <guilabel>Username</guilabel> field
on the login screen, then press <keycap>Return</keycap>.</para>
        </listitem>
        <listitem>
          <para>Enter your password in the <guilabel>Password</guilabel> field
on the login screen, then press <keycap>Return</keycap>.</para>
        </listitem>
      </orderedlist>
      <note>
        <para>When you log in to a session in a different language, you are changing 
the language for the user interface but are not changing the keyboard layout. 
To choose a different keyboard layout, use the 
<application>Keyboard Indicator</application> applet.</para>
      </note>
      <tip>
        <para>Your system distributor or vendor may have altered the login 
        screen so that it no longer has a <guilabel>Language</guilabel> icon. 
        In this case, the option to change the session's language may be found by clicking the <guilabel>Other</guilabel> icon.</para>
      </tip>
    </sect2>
  </sect1>
  <sect1 id="lock-screen">
    <title>Locking Your Screen</title>
    <!-- preserve id for backwards compatibility: 2.12 -->
    <anchor id="gosstartsession-1"/>        
    <screenshot>
      <mediaobject>
        <imageobject>
          <imagedata fileref="figures/lockscreen_icon.png" format="PNG"/>
        </imageobject>
        <textobject>
          <phrase>Lock screen icon.</phrase>
        </textobject>
      </mediaobject>
    </screenshot>
    <indexterm>
      <primary>sessions</primary>
      <secondary>locking screen</secondary>
    </indexterm>
    <indexterm>
      <primary>locking screen</primary>
    </indexterm>
    <indexterm>
      <primary>Lock button</primary>
    </indexterm>
    <para>Locking your screen prevents access to your applications and information, allowing you to leave your computer unattended. While your screen is locked, the screensaver runs.</para>
    
    <para>To lock the screen, perform
one of the following actions:</para>
    <itemizedlist>
      <listitem>
        <para>Choose <menuchoice><guimenu>System</guimenu><guimenuitem>Lock Screen</guimenuitem></menuchoice>.</para>
      </listitem>
      <listitem>
        <para>If the <guibutton>Lock Screen</guibutton> button is present on a
panel, click on the <guibutton>Lock Screen</guibutton> button.</para>
        <note><para>The <guibutton>Lock Screen</guibutton> button is not present on the panels by default. To add it, see <xref linkend="panels-addobject"/>.</para></note>
      </listitem>
    </itemizedlist>
    <para>To unlock the screen, move your mouse or press any key, enter your password in the locked screen dialog, then press <keycap>Return</keycap>.</para>
    <para>If another user wants to use the computer while it is locked, they can move the mouse or press a key and then click <guibutton>Switch User</guibutton>. The login screen will be displayed and they can log in using their user account. They will not be able to access any of your applications or information. When they log out, the screen will be locked again and you can access your session by unlocking the screen.</para>
  <para>You can leave a message for a user who has locked their screen. Move the mouse or press any key and then click <guibutton>Leave Message</guibutton>. Type your message into the box and press <guibutton>Save</guibutton>. Your message will be displayed when the user unlocks their screen.</para>
  </sect1>

  <sect1 id="gosstartsession-2">
    <title>Setting Programs to Start Automatically When You Log In</title>
    <indexterm>
      <primary>preference tools</primary>
      <secondary>Sessions</secondary>
    </indexterm>
    <indexterm>
      <primary>sessions</primary>
      <secondary>startup</secondary>
    </indexterm>
  <para>You can choose for certain programs to be started automatically when 
  you log in to a session. For example, you might want a web browser to be started 
  as soon as you log in. Programs which start automatically when you log in are 
  called <firstterm>startup programs</firstterm>. Startup programs are 
  automatically saved and safely closed by the session manager when you log 
  out, and are restarted when you log in.</para>
  <para>The <application>Sessions</application> preference tool allows you to 
  define which programs are started automatically when you log in. It has two 
  tabs, the <guilabel>Startup Programs</guilabel> tab and the 
  <guilabel>Options</guilabel> tab.</para>

    <sect2 id="gosstartsession-21">
      <title>Startup Programs Tab</title>
        <!-- Preserve IDs for backwards compatibility -->
        <anchor id="gosstartsession-6"/>
        <anchor id="gosstartsession-10"/>
      <para>You can use the Startup Programs tab to add, modify, and 
      remove startup programs.</para>
      <para>A list of startup programs is displayed on this tab. The list shows 
      a short description of each program, along with a checkbox which denotes 
      whether the startup program is enabled or not. Programs which are not 
      enabled will not be started automatically when you log in.</para>

      <sect3 id="gosstartsession-211">
       <title>Enabling/Disabling Startup Programs</title>
       <para>To enable a program to start up automatically, check the checkbox 
       corresponding to that program.</para>
       <para>To disable a program from starting automatically, uncheck the 
       checkbox.</para>
      </sect3>
      <sect3 id="gosstartsession-212">
       <title>Adding A New Startup Program</title>
       <para>To add a new startup program, perform the following steps:</para>
       <procedure>
        <step>
         <para>Click <guibutton>Add</guibutton>. This will open the 
         <application>Add Startup Program</application> dialog box.</para>
        </step>
        <step>
         <para>Use the <guilabel>Name</guilabel> text box to specify a name for 
         the new startup program.</para>
        </step>
        <step>
         <para>Use the <guilabel>Command</guilabel> text box to specify the 
         command which will invoke the application. For example, the command 
         <userinput>pluma</userinput> will start the <application>Pluma Text 
         Editor</application>. If you do not know the exact command, click 
         <guibutton>Browse</guibutton> to choose the path of the command.</para>
        </step>
        <step>
         <para>Enter a description of the application in the 
         <guilabel>Comments</guilabel> text box. You will see this as the 
         description of the program in the list of startup programs.</para>
        </step>
        <step>
         <para>Click <guibutton>Add</guibutton>. The application will be added 
         to the list of startup programs with its checkbox in the checked 
         (enabled) state.</para>
        </step>
       </procedure>
      </sect3>
      <sect3 id="gosstartsession-213">
       <title>Removing A Startup Program</title>
       <para>To remove a startup program, select it from the list of startup 
       programs and click <guibutton>Remove</guibutton>.</para>
      </sect3>
      <sect3 id="gosstartsession-214">
       <title>Editing A Startup Program</title>
       <para>To edit an existing startup program, select it from the list of 
       startup programs and click <guibutton>Edit</guibutton>. A dialog will 
       appear which allows you to edit the properties of the program. See 
       <xref linkend="gosstartsession-212"/> for more information on the 
       options available in this dialog.</para>
      </sect3>
    </sect2>
    
    <sect2 id="gosstartsession-22">
      <title>Session Options Tab</title>
        <!-- Preserve IDs for backwards compatibility -->
        <anchor id="gosstartsession-9"/>
        <anchor id="gosgetstarted-74"/>
      <para>The session manager can remember which applications you have 
      running when you log out and can automatically restart them when you log 
      in again. If you would like this to happen every time you log out, check 
      <guilabel>Automatically remember running applications when 
      logging out</guilabel>. If you would like this to happen only once, click 
      <guibutton>Remember Currently Running Application</guibutton> before 
      logging out.</para>
    </sect2>
  </sect1>
  
  <sect1 id="shutdown">
    <title>Ending a Session</title>
    <!-- preserve id for backwards compatibility: 2.12 -->
    <anchor id="gosgetstarted-73"/>        
    <indexterm>
      <primary>sessions</primary>
      <secondary>ending</secondary>
    </indexterm>
    <indexterm>
      <primary>sessions</primary>
      <secondary>logging out</secondary>
    </indexterm>
    <indexterm>
      <primary>logging out</primary>
    </indexterm>
    <indexterm>
      <primary>quit</primary>
    </indexterm>
    <indexterm>
      <primary>shutdown</primary>
    </indexterm>  
    <!--  
    commenting this out for now. A shot of the shutdown button would be good too.
    <screenshot>
      <mediaobject>
        <imageobject>
          <imagedata fileref="figures/logout_icon.png" format="PNG"/>
        </imageobject>
        <textobject>
          <phrase>Log Out icon.</phrase>
        </textobject>
      </mediaobject>
    </screenshot>
    -->
    <para>When you have finished using your computer, you can choose to do one of the following:</para>
    <itemizedlist>
      <listitem>
        <para>Log out, leaving the computer ready for another user to begin working with it. To log out of MATE, choose <menuchoice><guimenu>System</guimenu><guimenuitem>Log Out <replaceable>username</replaceable></guimenuitem></menuchoice> <!-- Translators: your locale might only have a "Log Out" label in the menu if "Log Out username" is not valid. In this case, remove "<replaceable>username</replaceable>". -->.</para>
      </listitem>
      <listitem>
        <para>Shut down your computer and switch off the power. To shut down, choose <menuchoice><guimenu>System</guimenu><guimenuitem>Shut Down</guimenuitem></menuchoice> and click <guibutton>Shut Down</guibutton> on the dialog that appears.</para>
      </listitem>
      <listitem>
        <para>Depending on your computer's configuration, you can also <firstterm>Hibernate</firstterm> your computer. During hibernation, less power is used, but all of the applications and documents that you have open are preserved and will still be open when you resume from hibernation. You can resume from hibernation by moving your mouse or pressing a key.</para>
      </listitem>
    </itemizedlist>
    
    <note>
        <para>Some vendors and distributors allow you to hibernate your computer in two ways, often called Hibernate and <firstterm>Suspend</firstterm>. Both of these will preserve your open files and applications, but one will switch off the power to your computer while the other will leave the computer running in a state that uses less power.</para>
    </note>
       
    <para>When you end a session, applications with unsaved work will warn you. You can choose to save your work, or cancel the command to log out or shut down.</para>

    <para>Before you end a session, you might want to save your current
settings so that you can restore the session later. In the <link linkend="prefs-sessions"><application>Sessions</application></link> preference tool, you can select an option to automatically
save your current settings.</para>
  </sect1>
</chapter>
