## libconsolekit libconsolekit — Helper library to query various ConsoleKit properties |

## Functions

GQuark | lib_consolekit_error_quark ()
LibConsoleKit * | lib_consolekit_new ()
gboolean | lib_consolekit_seat_get_active ()
gint | lib_consolekit_seat_get_sessions ()
gboolean | lib_consolekit_seat_can_multi_session ()
gboolean | lib_consolekit_session_is_active ()
gboolean | lib_consolekit_session_is_remote ()
gboolean | lib_consolekit_session_get_class ()
gboolean | lib_consolekit_session_get_uid ()
gboolean | lib_consolekit_session_get_seat ()
gboolean | lib_consolekit_session_get_state ()
gboolean | lib_consolekit_session_get_display ()
gboolean | lib_consolekit_session_get_remote_host ()
gboolean | lib_consolekit_session_get_tty ()
gboolean | lib_consolekit_session_get_type ()
gboolean | lib_consolekit_session_get_vt ()
gboolean | lib_consolekit_pid_get_session ()

## Types and Values

enum | LibConsoleKitError

## Object Hierarchy

        GObject
        ╰── LibConsoleKit

## Includes

    #include <libconsolekit.h>

## Description

A LibConsoleKit provides a way to easily query information from the ConsoleKit daemon.

## Functions

### lib_consolekit_error_quark ()

    GQuark
    lib_consolekit_error_quark (void);

Registers an error quark for LibConsoleKit if necessary.

#### Returns

the error quark used for LibConsoleKit errors.

### lib_consolekit_new ()

    LibConsoleKit *
    lib_consolekit_new (void);

Creates and returns a new instance of LibConsoleKit.

[skip]

#### Returns

a new instance of LibConsoleKit.

[transfer full]

Since: 1.0

### lib_consolekit_seat_get_active ()

    gboolean
    lib_consolekit_seat_get_active (LibConsoleKit *ck,
                                    const gchar *seat,
                                    gchar **session,
                                    uid_t *uid,
                                    GError **error);

Returns the session and uid of the user who has the active session on the seat, if any session is active. Free the session with g_free when done.

#### Parameters

ck | A LibConsoleKit |
seat | The seat to query |
session | The active session, if any. | [out][transfer full]
uid | The unix user the session belongs to. | [out][allow-none]
error | The error message if something failed. | [out][allow-none][transfer full]

#### Returns

TRUE on Success.

Since: 1.0

### lib_consolekit_seat_get_sessions ()

    gint
    lib_consolekit_seat_get_sessions (LibConsoleKit *ck,
                                      const gchar *seat,
                                      gchar ***sessions,
                                      GError **error);

Returns the sessions on the seat. Free the sessions with g_strfreev when done.

#### Parameters

ck | A LibConsoleKit |
seat | The seat to query |
sessions | The sessions on the seat, if any. | [out][transfer full][array zero-terminated=1]
error | The error message if something failed. | [out][allow-none][transfer full]

#### Returns

The number of sessions returned or -1 on failure

Since: 1.0

### lib_consolekit_seat_can_multi_session ()

    gboolean
    lib_consolekit_seat_can_multi_session (LibConsoleKit *ck,
                                           const gchar *seat,
                                           GError **error);

Returns whether the provided seat is capable of holding multiple sessions at any given time.

#### Parameters

ck | A LibConsoleKit |
seat | The seat to query |
error | The error message if something failed. | [out][allow-none][transfer full]

#### Returns

TRUE if capable of multiple sessions.

Since: 1.0

### lib_consolekit_session_is_active ()

    gboolean
    lib_consolekit_session_is_active (LibConsoleKit *ck,
                                      const gchar *session,
                                      GError **error);

Returns whether the provided session is active.

#### Parameters

ck | A LibConsoleKit |
session | The session to query |
error | The error message if something failed. | [out][allow-none][transfer full]

#### Returns

TRUE if the session is active.

Since: 1.0

### lib_consolekit_session_is_remote ()

    gboolean
    lib_consolekit_session_is_remote (LibConsoleKit *ck,
                                      const gchar *session,
                                      GError **error);

Returns whether the provided session is remote.

#### Parameters

ck | A LibConsoleKit |
session | The session to query |
error | The error message if something failed. | [out][allow-none][transfer full]

#### Returns

TRUE if the session is remote, FALSE if local. Defaults to TRUE on error.

Since: 1.0

### lib_consolekit_session_get_class ()

    gboolean
    lib_consolekit_session_get_class (LibConsoleKit *ck,
                                      const gchar *session,
                                      gchar **session_class,
                                      GError **error);

Returns the class of the provided session. The following classes may be returned: "user" - A normal user session, the default "greeter" - Display Manager pseudo session "lock-screen" - Screensaver based session "background" - A long running background process that requires its own session

Note: Additional classes may be added in the future. Free the session_class string with g_free.

#### Parameters

ck | A LibConsoleKit |
session | The session to query |
session_class | The session's class. | [out][transfer full]
error | The error message if something failed. | [out][allow-none][transfer full]

#### Returns

TRUE on Success.

Since: 1.0

### lib_consolekit_session_get_uid ()

    gboolean
    lib_consolekit_session_get_uid (LibConsoleKit *ck,
                                    const gchar *session,
                                    uid_t *uid,
                                    GError **error);

Returns the unix user who owns the session.

#### Parameters

ck | A LibConsoleKit |
session | The session to query |
uid | unix-user who owns the session. | [out][transfer full]
error | The error message if something failed. | [out][allow-none][transfer full]

#### Returns

TRUE on Success.

Since: 1.0

### lib_consolekit_session_get_seat ()

    gboolean
    lib_consolekit_session_get_seat (LibConsoleKit *ck,
                                     const gchar *session,
                                     gchar **seat,
                                     GError **error);

Returns the seat the session belongs to. Free the seat string with g_free when finished.

#### Parameters

ck | A LibConsoleKit |
session | The session to query |
seat | The seat the session belongs to. | [out][transfer full]
error | The error message if something failed. | [out][allow-none][transfer full]

#### Returns

TRUE on Success.

Since: 1.0

### lib_consolekit_session_get_state ()

    gboolean
    lib_consolekit_session_get_state (LibConsoleKit *ck,
                                      const gchar *session,
                                      gchar **state,
                                      GError **error);

Returns the current state of the provided session. The following states may be returned: "online" - Session is logged in but not active "active" - Session is logged in and active "closing" - Session is in the process of shutting down

Note: Additional states may be added in the future. Free the state string with g_free.

#### Parameters

ck | A LibConsoleKit |
session | The session to query |
state | The session's state. | [out][transfer full]
error | The error message if something failed. | [out][allow-none][transfer full]

#### Returns

TRUE on Success.

Since: 1.0

### lib_consolekit_session_get_display ()

    gboolean
    lib_consolekit_session_get_display (LibConsoleKit *ck,
                                        const gchar *session,
                                        gchar **display,
                                        GError **error);

Returns the display the session has, if any. Free the display string with g_free when finished.

#### Parameters

ck | A LibConsoleKit |
session | The session to query |
display | The X11 display the session owns. | [out][transfer full]
error | The error message if something failed. | [out][allow-none][transfer full]

#### Returns

TRUE on Success.

Since: 1.0

### lib_consolekit_session_get_remote_host ()

    gboolean
    lib_consolekit_session_get_remote_host
                                   (LibConsoleKit *ck,
                                    const gchar *session,
                                    gchar **remote_host,
                                    GError **error);

Returns the hostname of the remote session the session has, if any. Free the remote_host string with g_free when finished.

#### Parameters

ck | A LibConsoleKit |
session | The session to query |
remote_host | The remote hostname, if any. | [out][transfer full]
error | The error message if something failed. | [out][allow-none][transfer full]

#### Returns

TRUE on Success.

Since: 1.0

### lib_consolekit_session_get_tty ()

    gboolean
    lib_consolekit_session_get_tty (LibConsoleKit *ck,
                                    const gchar *session,
                                    gchar **tty,
                                    GError **error);

Returns the tty the session has, if any. Free the tty string with g_free when finished.

#### Parameters

ck | A LibConsoleKit |
session | The session to query |
tty | The tty attached to the session. | [out][transfer full]
error | The error message if something failed. | [out][allow-none][transfer full]

#### Returns

TRUE on Success.

Since: 1.0

### lib_consolekit_session_get_type ()

    gboolean
    lib_consolekit_session_get_type (LibConsoleKit *ck,
                                     const gchar *session,
                                     gchar **type,
                                     GError **error);

Returns the display type of the provided session. The following types may be returned: "x11" - An X11/Xorg based session "wayland" - A Wayland based session "tty" - A text console based session "mir" - A session using the Mir display server "unspecified" - Unknown session type.

Note: Additional types may be added in the future. Free the type string with g_free.

#### Parameters

ck | A LibConsoleKit |
session | The session to query |
type | The session's display type. | [out][transfer full]
error | The error message if something failed. | [out][allow-none][transfer full]

#### Returns

TRUE on Success.

Since: 1.0

### lib_consolekit_session_get_vt ()

    gboolean
    lib_consolekit_session_get_vt (LibConsoleKit *ck,
                                   const gchar *session,
                                   guint *vt,
                                   GError **error);

Returns the VT the session is on, if any.

#### Parameters

ck | A LibConsoleKit |
session | The session to query |
vt | (out) : The VT of the session, if any |
error | The error message if something failed. | [out][allow-none][transfer full]

#### Returns

TRUE on Success.

Since: 1.0

### lib_consolekit_pid_get_session ()

    gboolean
    lib_consolekit_pid_get_session (LibConsoleKit *ck,
                                    pid_t pid,
                                    gchar **session,
                                    GError **error);

Returns the session the pid belongs to, if any. Free the session string with g_free when finished.

#### Parameters

ck | A LibConsoleKit |
pid | process to query |
session | The session the pid belongs to. | [out][transfer full]
error | The error message if something failed. | [out][allow-none][transfer full]

#### Returns

TRUE on Success.

Since: 1.0

## Types and Values

### enum LibConsoleKitError

Describes errors that may result from operations involving a LibConsoleKit.

#### Members

CONSOLEKIT_ERROR_FAILED | unknown or unclassified error |
CONSOLEKIT_ERROR_INVALID_INPUT | the variable passed into the calling function is invalid. |