.. _org.freedesktop.portal.Inhibit:

==============================
 Inhibit
==============================

-----------
Description
-----------

.. _org.freedesktop.portal.Inhibit Description:

Portal for inhibiting session transitions

This simple interface lets sandboxed applications inhibit the user
session from ending, suspending, idling or getting switched away.

This documentation describes version 3 of this interface.



.. _org.freedesktop.portal.Inhibit Properties:

----------
Properties
----------

.. _org.freedesktop.portal.Inhibit:version:

org.freedesktop.portal.Inhibit:version
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

::

    version readable u




.. _org.freedesktop.portal.Inhibit Methods:

-------
Methods
-------

.. _org.freedesktop.portal.Inhibit.Inhibit:

org.freedesktop.portal.Inhibit.Inhibit
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

::

    Inhibit (
      IN window s,
      IN flags u,
      IN options a{sv},
      OUT handle o
    )



Inhibits a session status changes. To remove the inhibition,
call :ref:`org.freedesktop.portal.Request.Close` on the returned
handle.

The flags determine what changes are inhibited:

- ``1``: Logout
- ``2``: User Switch
- ``4``: Suspend
- ``8``: Idle

Supported keys in the ``options`` vardict include:

* ``handle_token`` (``s``)

  A string that will be used as the last element of the ``handle``. Must be a valid
  object path element. See the :ref:`org.freedesktop.portal.Request` documentation for
  more information about the ``handle``.

* ``reason`` (``s``)

  User-visible reason for the inhibition.



window
  Identifier for the window

flags
  Flags identifying what is inhibited

options
  Vardict with optional further information

handle
  Object path for the :ref:`org.freedesktop.portal.Request` object representing this call



.. _org.freedesktop.portal.Inhibit.CreateMonitor:

org.freedesktop.portal.Inhibit.CreateMonitor
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

::

    CreateMonitor (
      IN window s,
      IN options a{sv},
      OUT handle o
    )



Creates a monitoring session. While this session is
active, the caller will receive StateChanged signals
with updates on the session state.

A successfully created session can at any time be closed using
org.freedesktop.portal.Session::Close, or may at any time be closed
by the portal implementation, which will be signalled via
:ref:`org.freedesktop.portal.Session::Closed`.

Supported keys in the ``options`` vardict include:

* ``handle_token`` (``s``)

  A string that will be used as the last element of the ``handle``. Must be a valid
  object path element. See the :ref:`org.freedesktop.portal.Request` documentation for
  more information about the ``handle``.

* ``session_handle_token`` (``s``)

  A string that will be used as the last element of the session handle. Must be a valid
  object path element. See the :ref:`org.freedesktop.portal.Session` documentation for
  more information about the session handle.

The following results get returned via the :ref:`org.freedesktop.portal.Request::Response` signal:

* ``session_handle`` (``s``)

  The session handle. An object path for the
  :ref:`org.freedesktop.portal.Session` object representing the created
  session.

  .. note::
    The ``session_handle`` is an object path that was erroneously implemented
    as ``s``. For backwards compatibility it will remain this type.

This method was added in version 2 of this interface.



window
  the parent window

options
  Vardict with optional further information

handle
  Object path for the :ref:`org.freedesktop.portal.Request` object representing this call



.. _org.freedesktop.portal.Inhibit.QueryEndResponse:

org.freedesktop.portal.Inhibit.QueryEndResponse
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

::

    QueryEndResponse (
      IN session_handle o
    )



Acknowledges that the caller received the `org.freedesktop.portal.Inhibit::StateChanged`_
signal. This method should be called within one second or receiving a StateChanged
signal with the 'Query End' state.

Since version 3.



session_handle
  Object path for the :ref:`org.freedesktop.portal.Session` object


.. _org.freedesktop.portal.Inhibit Signals:

-------
Signals
-------

.. _org.freedesktop.portal.Inhibit::StateChanged:

org.freedesktop.portal.Inhibit::StateChanged
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

::

    StateChanged (
      session_handle o,
      state a{sv}
    )



The StateChanged signal is sent to active monitoring sessions when
the session state changes.

When the session state changes to 'Query End', clients with active monitoring
sessions are expected to respond by calling
`org.freedesktop.portal.Inhibit.QueryEndResponse`_ within a second
of receiving the StateChanged signal. They may call `org.freedesktop.portal.Inhibit.Inhibit`_
first to inhibit logout, to prevent the session from proceeding to the Ending state.

The following information may get returned in the ``state`` vardict:

* ``screensaver-active`` (``b``)

  Whether the screensaver is active.

* ``session-state`` (``u``)

  The state of the session. This member is new in version 3.

  - ``1``: Running
  - ``2``: Query End
  - ``3``: Ending



session_handle
  Object path for the :ref:`org.freedesktop.portal.Session` object

state
  Vardict with information about the session state


