<refentry id="Session">
  <refmeta>
    <refentrytitle role="top_of_page">org.freedesktop.ConsoleKit.Session</refentrytitle>
  </refmeta>
  <refnamediv>
    <refname>org.freedesktop.ConsoleKit.Session</refname>
    <refpurpose>Session interface</refpurpose>
  </refnamediv>
  <refsynopsisdiv role="synopsis">
    <title role="synopsis.title">Methods</title>
    <synopsis><link linkend="Session.GetId">GetId</link>               (out 'o' ssid)
<link linkend="Session.GetSeatId">GetSeatId</link>           (out 'o' sid)
<link linkend="Session.GetSessionType">GetSessionType</link>      (out 's' type)
<link linkend="Session.GetSessionClass">GetSessionClass</link>     (out 's' type)
<link linkend="Session.GetSessionState">GetSessionState</link>     (out 's' type)
<link linkend="Session.GetUser">GetUser</link>             (out 'u' uid)
<link linkend="Session.GetUnixUser">GetUnixUser</link>         (out 'u' uid)
<link linkend="Session.GetXDGRuntimeDir">GetXDGRuntimeDir</link>    (out 's' xdg_runtime_dir)
<link linkend="Session.GetX11Display">GetX11Display</link>       (out 's' display)
<link linkend="Session.GetX11DisplayDevice">GetX11DisplayDevice</link> (out 's' x11_display_device)
<link linkend="Session.GetDisplayDevice">GetDisplayDevice</link>    (out 's' display_device)
<link linkend="Session.GetRemoteHostName">GetRemoteHostName</link>   (out 's' remote_host_name)
<link linkend="Session.GetLoginSessionId">GetLoginSessionId</link>   (out 's' login_session_id)
<link linkend="Session.GetVTNr">GetVTNr</link>             (out 'u' VTNr)
<link linkend="Session.IsActive">IsActive</link>            (out 'b' active)
<link linkend="Session.IsLocal">IsLocal</link>             (out 'b' local)
<link linkend="Session.GetCreationTime">GetCreationTime</link>     (out 's' iso8601_datetime)
<link linkend="Session.Activate">Activate</link>            ()
<link linkend="Session.Lock">Lock</link>                ()
<link linkend="Session.Unlock">Unlock</link>              ()
<link linkend="Session.GetIdleHint">GetIdleHint</link>         (out 'b' idle_hint)
<link linkend="Session.GetIdleSinceHint">GetIdleSinceHint</link>    (out 's' iso8601_datetime)
<link linkend="Session.SetIdleHint">SetIdleHint</link>         (in  'b' idle_hint)
<link linkend="Session.SetLockedHint">SetLockedHint</link>       (in  'b' locked_hint)
<link linkend="Session.CanControlSession">CanControlSession</link>   (out 'b' controller_supported)
<link linkend="Session.TakeControl">TakeControl</link>         (in  'b' force)
<link linkend="Session.ReleaseControl">ReleaseControl</link>      ()
<link linkend="Session.TakeDevice">TakeDevice</link>          (in  'u' major,
                     in  'u' minor,
                     out 'h' fd,
                     out 'b' inactive)
<link linkend="Session.ReleaseDevice">ReleaseDevice</link>       (in  'u' major,
                     in  'u' minor)
<link linkend="Session.PauseDeviceComplete">PauseDeviceComplete</link> (in  'u' major,
                     in  'u' minor)
</synopsis>
  </refsynopsisdiv>
  <refsect1 role="signal_proto">
    <title role="signal_proto.title">Signals</title>
    <synopsis><link linkend="Session::PauseDevice">PauseDevice</link>     ('u' major,
                 'u' minor,
                 's' type)
<link linkend="Session::ResumeDevice">ResumeDevice</link>    ('u' major,
                 'u' minor,
                 'h' fd)
<link linkend="Session::ActiveChanged">ActiveChanged</link>   ('b' is_active)
<link linkend="Session::IdleHintChanged">IdleHintChanged</link> ('b' hint)
<link linkend="Session::Lock">Lock</link>            ()
<link linkend="Session::Unlock">Unlock</link>          ()
</synopsis>
  </refsect1>
  <refsect1 role="impl_interfaces">
    <title role="impl_interfaces.title">Implemented Interfaces</title>
    <para>
    Objects implementing org.freedesktop.ConsoleKit.Session also implements
    org.freedesktop.DBus.Introspectable,
    org.freedesktop.DBus.Properties
    </para>
  </refsect1>
  <refsect1 role="properties">
    <title role="properties.title">Properties</title>
    <synopsis><link linkend="Session:unix-user">'unix-user'</link>          read      'u'
<link linkend="Session:user">'user'</link>               read      'u'
<link linkend="Session:Seat">'Seat'</link>               read      '(so)'
<link linkend="Session:session-type">'session-type'</link>       read      's'
<link linkend="Session:session-class">'session-class'</link>      read      's'
<link linkend="Session:session-state">'session-state'</link>      read      's'
<link linkend="Session:remote-host-name">'remote-host-name'</link>   read      's'
<link linkend="Session:display-device">'display-device'</link>     read      's'
<link linkend="Session:x11-display">'x11-display'</link>        read      's'
<link linkend="Session:x11-display-device">'x11-display-device'</link> read      's'
<link linkend="Session:VTNr">'VTNr'</link>               read      'u'
<link linkend="Session:active">'active'</link>             read      'b'
<link linkend="Session:is-local">'is-local'</link>           read      'b'
<link linkend="Session:idle-hint">'idle-hint'</link>          readwrite 'b'
<link linkend="Session:LockedHint">'LockedHint'</link>         read      'b'
</synopsis>
  </refsect1>
  <refsect1 role="desc"><title role="desc.title">Description</title>
      
        <para>Session objects represent and store information
        related to a user session.
        </para>
        <para>The properties associated with the Session
        specifically refer to the properties of the "session leader".
        </para>
      
    </refsect1>
  <refsect1 role="details">
    <title role="details.title">Details</title>
    <refsect2><title><anchor role="function" id="Session.GetId"/>GetId ()</title><indexterm><primary>GetId</primary><secondary>Session</secondary></indexterm><programlisting>GetId (out 'o' ssid)</programlisting><para>Returns the ID for Session.</para>
        <variablelist role="params"><varlistentry><term><parameter>ssid</parameter>:</term><listitem><simpara>Session ID</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Session.GetSeatId"/>GetSeatId ()</title><indexterm><primary>GetSeatId</primary><secondary>Session</secondary></indexterm><programlisting>GetSeatId (out 'o' sid)</programlisting><para>Returns the ID for the Seat the Session is
        attached to.</para>
        <para>May fail with CK_SESSION_ERROR_FAILED if the session isn't attached to a seat</para>
        <variablelist role="params"><varlistentry><term><parameter>sid</parameter>:</term><listitem><simpara>Seat ID</simpara></listitem></varlistentry></variablelist><para>
See also:
<link linkend="Seat">org.freedesktop.ConsoleKit.Seat</link></para></refsect2>
    <refsect2><title><anchor role="function" id="Session.GetSessionType"/>GetSessionType ()</title><indexterm><primary>GetSessionType</primary><secondary>Session</secondary></indexterm><programlisting>GetSessionType (out 's' type)</programlisting>
          <para>Returns the display type of the provided session. The following type may be returned:</para>
          <para>"x11"         - An X11/Xorg based session</para>
          <para>"wayland"     - A Wayland based session</para>
          <para>"tty"         - A text console based session</para>
          <para>"mir"         - A session using the Mir display server</para>
          <para>"unspecified" - Unknown session type, the default.</para>
          <para>Note: Additional types may be added in the future.</para>
        <variablelist role="params"><varlistentry><term><parameter>type</parameter>:</term><listitem><simpara>Session type</simpara></listitem></varlistentry></variablelist><para>
See also:
<link linkend="Session:session-type"><literal>session-type</literal></link></para></refsect2>
    <refsect2><title><anchor role="function" id="Session.GetSessionClass"/>GetSessionClass ()</title><indexterm><primary>GetSessionClass</primary><secondary>Session</secondary></indexterm><programlisting>GetSessionClass (out 's' type)</programlisting>
          <para>Returns the display type of the provided session. The following classes may be returned:</para>
          <para>"user"        - A normal user session, the default</para>
          <para>"greeter"     - Display Manager pseudo session</para>
          <para>"lock-screen" - Screensaver based session</para>
          <para>"background"  - A long running background process that requires its own session</para>
          <para>Note: Additional classes may be added in the future.</para>
          <para>Since 1.1.2</para>
        <variablelist role="params"><varlistentry><term><parameter>type</parameter>:</term><listitem><simpara>Session class</simpara></listitem></varlistentry></variablelist><para>
See also:
<link linkend="Session:session-class"><literal>session-class</literal></link></para></refsect2>
    <refsect2><title><anchor role="function" id="Session.GetSessionState"/>GetSessionState ()</title><indexterm><primary>GetSessionState</primary><secondary>Session</secondary></indexterm><programlisting>GetSessionState (out 's' type)</programlisting>
          <para>Returns the current state of the session. The following states may be returned:</para>
          <para>"online"    - Session is logged in but not active</para>
          <para>"active"    - Session is logged in and active</para>
          <para>"closing"   - Session is in the process of shutting down</para>
          <para>Note: Additional classes may be added in the future.</para>
          <para>Since 1.1.2</para>
        <variablelist role="params"><varlistentry><term><parameter>type</parameter>:</term><listitem><simpara>Session state</simpara></listitem></varlistentry></variablelist><para>
See also:
<link linkend="Session:session-state"><literal>session-state</literal></link></para></refsect2>
    <refsect2><title><anchor role="function" id="Session.GetUser"/>GetUser ()</title><indexterm><primary>GetUser</primary><secondary>Session</secondary></indexterm><programlisting>GetUser (out 'u' uid)</programlisting><para>Returns the user that the session belongs to.</para>
        <variablelist role="params"><varlistentry><term><parameter>uid</parameter>:</term><listitem><simpara>User ID</simpara></listitem></varlistentry></variablelist><para role="deprecated"><warning><para><literal>GetUser</literal> is deprecated since version 0.1.3 and should not be used in newly-written code. Use

  <link linkend="Session.GetUnixUser"><function>GetUnixUser</function></link>
instead.</para></warning></para><para>
See also:
<link linkend="Session:user"><literal>user</literal></link></para></refsect2>
    <refsect2><title><anchor role="function" id="Session.GetUnixUser"/>GetUnixUser ()</title><indexterm><primary>GetUnixUser</primary><secondary>Session</secondary></indexterm><programlisting>GetUnixUser (out 'u' uid)</programlisting><para>Returns the POSIX user ID that the session belongs to.</para>
        <variablelist role="params"><varlistentry><term><parameter>uid</parameter>:</term><listitem><simpara>POSIX User ID</simpara></listitem></varlistentry></variablelist><para>
See also:
<link linkend="Session:unix-user"><literal>unix-user</literal></link></para></refsect2>
    <refsect2><title><anchor role="function" id="Session.GetXDGRuntimeDir"/>GetXDGRuntimeDir ()</title><indexterm><primary>GetXDGRuntimeDir</primary><secondary>Session</secondary></indexterm><programlisting>GetXDGRuntimeDir (out 's' xdg_runtime_dir)</programlisting><para>Returns the XDG_RUNTIME_DIR location of the session.
        The XDG_RUNTIME_DIR is the same for all sessions of the same user and will be automatically
        removed once the last session of the user is closed.</para>
        <para>May fail with: CK_SESSION_ERROR_FAILED if it failed to create a runtime dir for the user (such as root).</para>
        <para>Since 1.1.0</para>
        <variablelist role="params"><varlistentry><term><parameter>xdg_runtime_dir</parameter>:</term><listitem><simpara>XDG_RUNTIME_DIR</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Session.GetX11Display"/>GetX11Display ()</title><indexterm><primary>GetX11Display</primary><secondary>Session</secondary></indexterm><programlisting>GetX11Display (out 's' display)</programlisting><para>Returns the value of the X11 DISPLAY for this session
        if one is present.</para>
        <variablelist role="params"><varlistentry><term><parameter>display</parameter>:</term><listitem><simpara>The value of the X11 display</simpara></listitem></varlistentry></variablelist><para>
See also:
<link linkend="Session:x11-display"><literal>x11-display</literal></link></para></refsect2>
    <refsect2><title><anchor role="function" id="Session.GetX11DisplayDevice"/>GetX11DisplayDevice ()</title><indexterm><primary>GetX11DisplayDevice</primary><secondary>Session</secondary></indexterm><programlisting>GetX11DisplayDevice (out 's' x11_display_device)</programlisting><para>Returns the value of the display device (aka TTY) that the
        X11 display for the session is connected to.  If there is no x11-display set then this value
        is undefined.</para>
        <variablelist role="params"><varlistentry><term><parameter>x11_display_device</parameter>:</term><listitem><simpara>The value of the X11 display device</simpara></listitem></varlistentry></variablelist><para>
See also:
<link linkend="Session:x11-display-device"><literal>x11-display-device</literal></link></para></refsect2>
    <refsect2><title><anchor role="function" id="Session.GetDisplayDevice"/>GetDisplayDevice ()</title><indexterm><primary>GetDisplayDevice</primary><secondary>Session</secondary></indexterm><programlisting>GetDisplayDevice (out 's' display_device)</programlisting><para>Returns the value of the display device (aka TTY) that the
        session is connected to.</para>
        <variablelist role="params"><varlistentry><term><parameter>display_device</parameter>:</term><listitem><simpara>The value of the display device</simpara></listitem></varlistentry></variablelist><para>
See also:
<link linkend="Session:display-device"><literal>display-device</literal></link></para></refsect2>
    <refsect2><title><anchor role="function" id="Session.GetRemoteHostName"/>GetRemoteHostName ()</title><indexterm><primary>GetRemoteHostName</primary><secondary>Session</secondary></indexterm><programlisting>GetRemoteHostName (out 's' remote_host_name)</programlisting><para>Returns the value of the remote host name for the session.
        </para>
        <variablelist role="params"><varlistentry><term><parameter>remote_host_name</parameter>:</term><listitem><simpara>The remote host name</simpara></listitem></varlistentry></variablelist><para>
See also:
<link linkend="Session:remote-host-name"><literal>remote-host-name</literal></link></para></refsect2>
    <refsect2><title><anchor role="function" id="Session.GetLoginSessionId"/>GetLoginSessionId ()</title><indexterm><primary>GetLoginSessionId</primary><secondary>Session</secondary></indexterm><programlisting>GetLoginSessionId (out 's' login_session_id)</programlisting><para>Returns the value of the login session ID that the
        underlying system uses to enforce session boundaries.  If there is no login session ID
        set then this value is an empty string.</para>
        <variablelist role="params"><varlistentry><term><parameter>login_session_id</parameter>:</term><listitem><simpara>The value of the native system login session ID</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Session.GetVTNr"/>GetVTNr ()</title><indexterm><primary>GetVTNr</primary><secondary>Session</secondary></indexterm><programlisting>GetVTNr (out 'u' VTNr)</programlisting><para>Returns the value of the virtual terminal that the
        underlying session runs on. If the seat doesn't support VTs, then this will always
        return 0.</para>
        <para>Since 1.1.2</para>
        <variablelist role="params"><varlistentry><term><parameter>VTNr</parameter>:</term><listitem><simpara>The virtual terminal the session runs on, if any, 0 otherwise</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Session.IsActive"/>IsActive ()</title><indexterm><primary>IsActive</primary><secondary>Session</secondary></indexterm><programlisting>IsActive (out 'b' active)</programlisting><para>Returns whether the session is active on the Seat that
        it is attached to.</para>
        <para>If the session is not attached to a seat this value is undefined.
        </para>
        <variablelist role="params"><varlistentry><term><parameter>active</parameter>:</term><listitem><simpara>TRUE if the session is active, otherwise FALSE</simpara></listitem></varlistentry></variablelist><para>
See also:
<link linkend="Session:active"><literal>active</literal></link></para></refsect2>
    <refsect2><title><anchor role="function" id="Session.IsLocal"/>IsLocal ()</title><indexterm><primary>IsLocal</primary><secondary>Session</secondary></indexterm><programlisting>IsLocal (out 'b' local)</programlisting><para>Returns whether the session is local</para>
        <para>FIXME: we need to come up with a concrete definition for this value.
        It was originally used as a way to identify XDMCP sessions that originate
        from a remote system.
        </para>
        <variablelist role="params"><varlistentry><term><parameter>local</parameter>:</term><listitem><simpara>TRUE if the session is local, otherwise FALSE</simpara></listitem></varlistentry></variablelist><para>
See also:
<link linkend="Session:is-local"><literal>is-local</literal></link></para></refsect2>
    <refsect2><title><anchor role="function" id="Session.GetCreationTime"/>GetCreationTime ()</title><indexterm><primary>GetCreationTime</primary><secondary>Session</secondary></indexterm><programlisting>GetCreationTime (out 's' iso8601_datetime)</programlisting>
          <para>Returns an ISO 8601 date-time string that corresponds to
          the time that the session was opened.
          </para>
        <variablelist role="params"><varlistentry><term><parameter>iso8601_datetime</parameter>:</term><listitem><simpara>An ISO 8601 format date-type string</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Session.Activate"/>Activate ()</title><indexterm><primary>Activate</primary><secondary>Session</secondary></indexterm><programlisting>Activate ()</programlisting>
          <para>Attempt to activate the this session.  In most
          cases, if successful, this will cause the session to
          become visible and become active on the seat that it
          is attached to.</para>
          <para>May fail with: CK_SESSION_ERROR_ALREADY_ACTIVE, CK_SESSION_ERROR_NOT_SUPPORTED, CK_SESSION_ERROR_GENERAL</para>
        <para>
See also:
<link linkend="Seat.ActivateSession"><function>Seat.ActivateSession()</function></link></para></refsect2>
    <refsect2><title><anchor role="function" id="Session.Lock"/>Lock ()</title><indexterm><primary>Lock</primary><secondary>Session</secondary></indexterm><programlisting>Lock ()</programlisting>
          <para>This will cause a <link linkend="Session::Lock"><literal>Lock</literal></link>
          signal to be emitted for this session.
          </para>
        <note><title>Permissions</title><para role="permission">This method is restricted to privileged users by D-Bus policy.</para></note><para>
See also:
<link linkend="Session::Lock"><literal>Lock signal</literal></link></para></refsect2>
    <refsect2><title><anchor role="function" id="Session.Unlock"/>Unlock ()</title><indexterm><primary>Unlock</primary><secondary>Session</secondary></indexterm><programlisting>Unlock ()</programlisting>
          <para>This will cause an <link linkend="Session::Unlock"><literal>Unlock</literal></link>
          signal to be emitted for this session.
          </para>
          <para>This can be used by login managers to unlock a session before it is
          re-activated during fast-user-switching.
          </para>
        <note><title>Permissions</title><para role="permission">This method is restricted to privileged users by D-Bus policy.</para></note><para>
See also:
<link linkend="Session::Unlock"><literal>Unlock signal</literal></link></para></refsect2>
    <refsect2><title><anchor role="function" id="Session.GetIdleHint"/>GetIdleHint ()</title><indexterm><primary>GetIdleHint</primary><secondary>Session</secondary></indexterm><programlisting>GetIdleHint (out 'b' idle_hint)</programlisting>
          <para>Gets the value of the <link linkend="Session:idle-hint"><literal>idle-hint</literal></link>
          property.
          </para>
        <variablelist role="params"><varlistentry><term><parameter>idle_hint</parameter>:</term><listitem><simpara>The value of the idle-hint</simpara></listitem></varlistentry></variablelist><para>
See also:
<link linkend="Session:idle-hint"><literal>idle-hint</literal></link></para></refsect2>
    <refsect2><title><anchor role="function" id="Session.GetIdleSinceHint"/>GetIdleSinceHint ()</title><indexterm><primary>GetIdleSinceHint</primary><secondary>Session</secondary></indexterm><programlisting>GetIdleSinceHint (out 's' iso8601_datetime)</programlisting>
          <para>Returns an ISO 8601 date-time string that corresponds to
          the time of the last change of the idle-hint.
          </para>
        <variablelist role="params"><varlistentry><term><parameter>iso8601_datetime</parameter>:</term><listitem><simpara>An ISO 8601 format date-type string</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Session.SetIdleHint"/>SetIdleHint ()</title><indexterm><primary>SetIdleHint</primary><secondary>Session</secondary></indexterm><programlisting>SetIdleHint (in  'b' idle_hint)</programlisting>
          <para>This may be used by the session to indicate that
          it is idle.
          </para>
          <para>Use of this method is restricted to the user
          that owns the session.</para>
        <variablelist role="params"><varlistentry><term><parameter>idle_hint</parameter>:</term><listitem><simpara>boolean value to set the idle-hint to</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Session.SetLockedHint"/>SetLockedHint ()</title><indexterm><primary>SetLockedHint</primary><secondary>Session</secondary></indexterm><programlisting>SetLockedHint (in  'b' locked_hint)</programlisting>
          <para> This is used by Desktop Environments to update the
          <link linkend="Session:LockedHint"><literal>LockedHint</literal></link>
          property. Calling <link linkend="Session.Lock"><function>Lock()</function></link>
          or <link linkend="Session.Unlock"><function>Unlock()</function></link> will also
          update the <link linkend="Session:LockedHint"><literal>LockedHint</literal></link>
          value.</para>
          <para>Use of this method is restricted to the user
          that owns the session.</para>
        <variablelist role="params"><varlistentry><term><parameter>locked_hint</parameter>:</term><listitem><simpara>boolean value to set the locked-hint to</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Session.CanControlSession"/>CanControlSession ()</title><indexterm><primary>CanControlSession</primary><secondary>Session</secondary></indexterm><programlisting>CanControlSession (out 'b' controller_supported)</programlisting>
          <para>Returns TRUE if the system has Session Controller support. This means
          the TakeControl call won't return CK_SESSION_ERROR_NOT_SUPPORTED.</para>
          <para>Since 1.3.0</para>
        <variablelist role="params"><varlistentry><term><parameter>controller_supported</parameter>:</term><listitem><simpara>Whether the system supports a session controller.</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Session.TakeControl"/>TakeControl ()</title><indexterm><primary>TakeControl</primary><secondary>Session</secondary></indexterm><programlisting>TakeControl (in  'b' force)</programlisting>
          <para>Allows a single process per session to request ConsoleKit2
          managed devices by calling <link linkend="Session.TakeDevice"><function>TakeDevice</function></link>.
          </para>
          <para>Use of this method is restricted to the user
          that owns the session or root. The force argument will be honored for
          root only.</para>
          <para>May fail with: CK_SESSION_ERROR_FAILED, CK_SESSION_ERROR_INSUFFICIENT_PERMISSION, CK_SESSION_ERROR_GENERAL, CK_SESSION_ERROR_NOT_SUPPORTED</para>
          <para>Since 1.1.1</para>
        <variablelist role="params"><varlistentry><term><parameter>force</parameter>:</term><listitem><simpara>If set to TRUE, an existing session controller is replaced.</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Session.ReleaseControl"/>ReleaseControl ()</title><indexterm><primary>ReleaseControl</primary><secondary>Session</secondary></indexterm><programlisting>ReleaseControl ()</programlisting>
          <para>The process that previously successfully called
          <link linkend="Session.TakeControl"><function>TakeControl</function></link>
          may use this to reliqunish control. Any devices acquired with
          <link linkend="Session.TakeDevice"><function>TakeDevice</function></link>
          will be released. If the session controller closes the dbus-connection,
          this will implicitly call ReleaseControl.
          </para>
          <para>Use of this method is restricted to the process that
          called <link linkend="Session.TakeControl"><function>TakeControl</function></link>.</para>
          <para>Since 1.1.1</para>
        </refsect2>
    <refsect2><title><anchor role="function" id="Session.TakeDevice"/>TakeDevice ()</title><indexterm><primary>TakeDevice</primary><secondary>Session</secondary></indexterm><programlisting>TakeDevice (in  'u' major,
            in  'u' minor,
            out 'h' fd,
            out 'b' inactive)</programlisting>
          <para>ConsoleKit2 automatically mutes the file-descriptor if the
          session is inactive and resumes it once the session gets active again.
          This guarantees that a session can only access session-devices if the
          session is active. Note that this revoke/resume mechanism is asynchronous
          and may happen at any given time. This only works on devices that are
          attached to the seat of the given session. A process is not required
          to have direct access to the device-node. Also note that any device
          can only be requested once. As long as you don't release it, further
          calls will fail.
          </para>
          <para>Use of this method is restricted to the session-controller,
          see <link linkend="Session.TakeControl"><function>TakeControl</function></link>.</para>
          <para>May fail with: CK_SESSION_ERROR_FAILED, CK_SESSION_ERROR_GENERAL, CK_SESSION_ERROR_NOT_SUPPORTED</para>
          <para>Since 1.1.1</para>
        <variablelist role="params"><varlistentry><term><parameter>major</parameter>:</term><listitem><simpara>Major number of the character-device.</simpara></listitem></varlistentry><varlistentry><term><parameter>minor</parameter>:</term><listitem><simpara>Minor number of the character-device.</simpara></listitem></varlistentry><varlistentry><term><parameter>fd</parameter>:</term><listitem><simpara>Returns a file descriptor for the specified device.</simpara></listitem></varlistentry><varlistentry><term><parameter>inactive</parameter>:</term><listitem><simpara>boolean value if the deivce is currently inactive.</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Session.ReleaseDevice"/>ReleaseDevice ()</title><indexterm><primary>ReleaseDevice</primary><secondary>Session</secondary></indexterm><programlisting>ReleaseDevice (in  'u' major,
               in  'u' minor)</programlisting>
          <para>Release a previously acquired device.
          </para>
          <para>Use of this method is restricted to the session-controller,
          see <link linkend="Session.TakeControl"><function>TakeControl</function></link>.</para>
          <para>Since 1.1.1</para>
        <variablelist role="params"><varlistentry><term><parameter>major</parameter>:</term><listitem><simpara>Major number of the character-device.</simpara></listitem></varlistentry><varlistentry><term><parameter>minor</parameter>:</term><listitem><simpara>Minor number of the character-device.</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Session.PauseDeviceComplete"/>PauseDeviceComplete ()</title><indexterm><primary>PauseDeviceComplete</primary><secondary>Session</secondary></indexterm><programlisting>PauseDeviceComplete (in  'u' major,
                     in  'u' minor)</programlisting>
          <para>Allows the session controller to synchronously pause a
          device in response to the
          <link linkend="Session::PauseDevice"><literal>PauseDevice</literal></link>
          signal. Forced signals are automatically completed by ConsoleKit2.
          </para>
          <para>Use of this method is restricted to the session-controller,
          see <link linkend="Session.TakeControl"><function>TakeControl</function></link>.</para>
          <para>Since 1.1.1</para>
        <variablelist role="params"><varlistentry><term><parameter>major</parameter>:</term><listitem><simpara>Major number of the character-device.</simpara></listitem></varlistentry><varlistentry><term><parameter>minor</parameter>:</term><listitem><simpara>Minor number of the character-device.</simpara></listitem></varlistentry></variablelist></refsect2>
  </refsect1>
  <refsect1 role="signals">
    <title role="signals.title">Signal Details</title>
    <refsect2><title><anchor role="function" id="Session::PauseDevice"/>The PauseDevice signal</title><indexterm><primary>PauseDevice</primary><secondary>Session</secondary></indexterm><programlisting>PauseDevice ('u' major,
             'u' minor,
             's' type)</programlisting>
          <para>Emitted for any device requested with
          <link linkend="Session.TakeDevice"><function>TakeDevice</function></link>.
          A device may remain paused for unknown reasons even though the Session
          is active. A type of 'force' means the device got paused by ConsoleKit2
          already and this is only a notification. A type of 'pause' means
          ConsoleKit2 is requesting to pause the device and grants the session
          controller a limited amount of time to pause it. The session controller
          must respond to this via
          <link linkend="Session.PauseDeviceComplete"><function>PauseDeviceComplete</function></link>.
          This synchronous pausing-mechanism is used for backwards-compatibility
          to VTs and ConsoleKit2 is free to not make use of it. ConsoleKit2 may
          also send a force PauseDevice if you don't respond in a timely manner
          (or for any other reason). A type of 'gone' means the device was unplugged from
          the system and you will no longer get any notifications about it.</para>
          <para>Since 1.1.1</para>
        <variablelist role="params"><varlistentry><term><parameter>major</parameter>:</term><listitem><simpara>Major number of the character-device.</simpara></listitem></varlistentry><varlistentry><term><parameter>minor</parameter>:</term><listitem><simpara>Minor number of the character-device.</simpara></listitem></varlistentry><varlistentry><term><parameter>type</parameter>:</term><listitem><simpara>Will either be: force, pause, or gone</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Session::ResumeDevice"/>The ResumeDevice signal</title><indexterm><primary>ResumeDevice</primary><secondary>Session</secondary></indexterm><programlisting>ResumeDevice ('u' major,
              'u' minor,
              'h' fd)</programlisting>
          <para>Emitted for any device requested with
          <link linkend="Session.TakeDevice"><function>TakeDevice</function></link>.
           Sent whenever a session is active and a device is resumed.
           It carries the major/minor as arguments and provides a new open
           file-descriptor. You should switch to the new descriptor and close
           the old one. They are not guaranteed to have the same underlying
           file descriptor.</para>
           <para>Since 1.1.1</para>
        <variablelist role="params"><varlistentry><term><parameter>major</parameter>:</term><listitem><simpara>Major number of the character-device.</simpara></listitem></varlistentry><varlistentry><term><parameter>minor</parameter>:</term><listitem><simpara>Minor number of the character-device.</simpara></listitem></varlistentry><varlistentry><term><parameter>fd</parameter>:</term><listitem><simpara>Will either be: force, pause, or gone</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Session::ActiveChanged"/>The ActiveChanged signal</title><indexterm><primary>ActiveChanged</primary><secondary>Session</secondary></indexterm><programlisting>ActiveChanged ('b' is_active)</programlisting>
          <para>Emitted when the active property has changed.</para>
        <variablelist role="params"><varlistentry><term><parameter>is_active</parameter>:</term><listitem><simpara>TRUE if the session is active, otherwise FALSE</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Session::IdleHintChanged"/>The IdleHintChanged signal</title><indexterm><primary>IdleHintChanged</primary><secondary>Session</secondary></indexterm><programlisting>IdleHintChanged ('b' hint)</programlisting>
          <para>Emitted when the idle-hint property has changed.</para>
        <variablelist role="params"><varlistentry><term><parameter>hint</parameter>:</term><listitem><simpara>the new value of idle-hint</simpara></listitem></varlistentry></variablelist></refsect2>
    <refsect2><title><anchor role="function" id="Session::Lock"/>The Lock signal</title><indexterm><primary>Lock</primary><secondary>Session</secondary></indexterm><programlisting>Lock ()</programlisting>
          <para>Emitted in response to a call to the <link linkend="Session.Lock"><function>Lock()</function></link> method.</para>
          <para>It is intended that the screensaver for the session should lock the screen in response to this signal.</para>
        </refsect2>
    <refsect2><title><anchor role="function" id="Session::Unlock"/>The Unlock signal</title><indexterm><primary>Unlock</primary><secondary>Session</secondary></indexterm><programlisting>Unlock ()</programlisting>
          <para>Emitted in response to a call to the <link linkend="Session.Unlock"><function>Unlock()</function></link> method.</para>
          <para>It is intended that the screensaver for the session should unlock the screen in response to this signal.</para>
        </refsect2>
  </refsect1>
  <refsect1 role="property_details">
    <title role="property_details.title">Property Details</title>
    <refsect2><title><anchor role="function" id="Session:unix-user"/>The "unix-user" property</title><indexterm><primary>unix-user</primary><secondary>Session</secondary></indexterm><programlisting>'unix-user'  read      'u'
</programlisting>
          <para>The user assigned to the session.</para>
        </refsect2>
    <refsect2><title><anchor role="function" id="Session:user"/>The "user" property</title><indexterm><primary>user</primary><secondary>Session</secondary></indexterm><programlisting>'user'  read      'u'
</programlisting>
          <para>The user assigned to the session.</para>
        <para role="deprecated"><warning><para><literal>user</literal> is deprecated since version 0.1.3 and should not be used in newly-written code. Use

  <link linkend="Session:unix-user"><literal>unix-user</literal></link>
instead.</para></warning></para></refsect2>
    <refsect2><title><anchor role="function" id="Session:Seat"/>The "Seat" property</title><indexterm><primary>Seat</primary><secondary>Session</secondary></indexterm><programlisting>'Seat'  read      '(so)'
</programlisting>
          <para>The seat the session is assigned to. It is comprised of the
          seat id and object path of the seat.</para>
        </refsect2>
    <refsect2><title><anchor role="function" id="Session:session-type"/>The "session-type" property</title><indexterm><primary>session-type</primary><secondary>Session</secondary></indexterm><programlisting>'session-type'  read      's'
</programlisting>
          <para>The type of the session.</para>
        </refsect2>
    <refsect2><title><anchor role="function" id="Session:session-class"/>The "session-class" property</title><indexterm><primary>session-class</primary><secondary>Session</secondary></indexterm><programlisting>'session-class'  read      's'
</programlisting>
          <para>The class of the session.</para>
        </refsect2>
    <refsect2><title><anchor role="function" id="Session:session-state"/>The "session-state" property</title><indexterm><primary>session-state</primary><secondary>Session</secondary></indexterm><programlisting>'session-state'  read      's'
</programlisting>
          <para>The state of the session.</para>
        </refsect2>
    <refsect2><title><anchor role="function" id="Session:remote-host-name"/>The "remote-host-name" property</title><indexterm><primary>remote-host-name</primary><secondary>Session</secondary></indexterm><programlisting>'remote-host-name'  read      's'
</programlisting>
          <para>The remote host name for the session.
          </para>
          <para>This will be set in situations where the session is
          opened and controlled from a remote system.
          </para>
          <para>For example, this value will be set when the
          session is created from an SSH or XDMCP connection.
          </para>
        </refsect2>
    <refsect2><title><anchor role="function" id="Session:display-device"/>The "display-device" property</title><indexterm><primary>display-device</primary><secondary>Session</secondary></indexterm><programlisting>'display-device'  read      's'
</programlisting>
          <para>The display device (aka TTY) that the
          session is connected to.
          </para>
        </refsect2>
    <refsect2><title><anchor role="function" id="Session:x11-display"/>The "x11-display" property</title><indexterm><primary>x11-display</primary><secondary>Session</secondary></indexterm><programlisting>'x11-display'  read      's'
</programlisting>
          <para>Value of the X11 DISPLAY for this session
          if one is present.
          </para>
        </refsect2>
    <refsect2><title><anchor role="function" id="Session:x11-display-device"/>The "x11-display-device" property</title><indexterm><primary>x11-display-device</primary><secondary>Session</secondary></indexterm><programlisting>'x11-display-device'  read      's'
</programlisting>
          <para>
          The display device (aka TTY) that the X11 display for the
          session is connected to.  If there is no x11-display set then
          this value is undefined.
          </para>
        </refsect2>
    <refsect2><title><anchor role="function" id="Session:VTNr"/>The "VTNr" property</title><indexterm><primary>VTNr</primary><secondary>Session</secondary></indexterm><programlisting>'VTNr'  read      'u'
</programlisting>
          <para>The virtual terminal the session runs on, if any, 0 otherwise.</para>
        </refsect2>
    <refsect2><title><anchor role="function" id="Session:active"/>The "active" property</title><indexterm><primary>active</primary><secondary>Session</secondary></indexterm><programlisting>'active'  read      'b'
</programlisting>
          <para>
          Whether the session is active on the Seat that
          it is attached to.</para>
          <para>If the session is not attached to a seat this value is undefined.
          </para>
        </refsect2>
    <refsect2><title><anchor role="function" id="Session:is-local"/>The "is-local" property</title><indexterm><primary>is-local</primary><secondary>Session</secondary></indexterm><programlisting>'is-local'  read      'b'
</programlisting>
          <para>
          Whether the session is local</para>
          <para>FIXME: we need to come up with a concrete definition for this value.
          It was originally used as a way to identify XDMCP sessions that originate
          from a remote system.
          </para>
        </refsect2>
    <refsect2><title><anchor role="function" id="Session:idle-hint"/>The "idle-hint" property</title><indexterm><primary>idle-hint</primary><secondary>Session</secondary></indexterm><programlisting>'idle-hint'  readwrite 'b'
</programlisting>
          <para>
          This is a hint used to indicate that the session may be idle.
          </para>
          <para>
          For sessions with a <link linkend="Session:x11-display"><literal>x11-display</literal></link> set (ie. graphical
          sessions), it is up to each session to delegate the
          responsibility for updating this value.  Typically, the
          screensaver will set this.
          </para>
          <para>However, for non-graphical sessions with a <link linkend="Session:display-device"><literal>display-device</literal></link> set
          the Session object itself will periodically update this value based
          on the activity detected on the display-device itself.
          </para>
          <para>
          This should not be considered authoritative.
          </para>
        </refsect2>
    <refsect2><title><anchor role="function" id="Session:LockedHint"/>The "LockedHint" property</title><indexterm><primary>LockedHint</primary><secondary>Session</secondary></indexterm><programlisting>'LockedHint'  read      'b'
</programlisting>
          <para>
          This is a hint used by Desktop Environments to indicate that the
          session may be locked.
          </para>
        </refsect2>
  </refsect1>
</refentry>
