GnomeDesktop.IdleMonitor

g GObject.GInterface GObject.GInterface Gio.Initable Gio.Initable GObject.GInterface->Gio.Initable GObject.Object GObject.Object GnomeDesktop.IdleMonitor GnomeDesktop.IdleMonitor GObject.Object->GnomeDesktop.IdleMonitor Gio.Initable->GnomeDesktop.IdleMonitor

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gio.Initable (2)

Structs:

GObject.ObjectClass (5)

class

new ()

add_idle_watch (interval_msec, callback, *user_data)

add_user_active_watch (callback, *user_data)

get_idletime ()

remove_watch (id)

Virtual Methods

Inherited:

GObject.Object (7), Gio.Initable (1)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class GnomeDesktop.IdleMonitor(**kwargs)
Bases:

GObject.Object, Gio.Initable

Abstract:

No

Structure:

GnomeDesktop.IdleMonitorClass

classmethod new()
Returns:

a new GnomeDesktop.IdleMonitor that tracks the server-global idletime for all devices.

Return type:

GnomeDesktop.IdleMonitor

add_idle_watch(interval_msec, callback, *user_data)
Parameters:
  • interval_msec (int) – The idletime interval, in milliseconds. It must be a strictly positive value (> 0).

  • callback (GnomeDesktop.IdleMonitorWatchFunc or None) – The callback to call when the user has accumulated interval_msec milliseconds of idle time.

  • user_data (object or None) – The user data to pass to the callback

Returns:

a watch id

Adds a watch for a specific idle time. The callback will be called when the user has accumulated interval_msec milliseconds of idle time. This function will return an ID that can either be passed to GnomeDesktop.IdleMonitor.remove_watch(), or can be used to tell idle time watches apart if you have more than one.

Also note that this function will only care about positive transitions (user’s idle time exceeding a certain time). If you want to know about when the user has become active, use GnomeDesktop.IdleMonitor.add_user_active_watch().

Return type:

int

add_user_active_watch(callback, *user_data)
Parameters:
Returns:

a watch id

Add a one-time watch to know when the user is active again. Note that this watch is one-time and will de-activate after the function is called, for efficiency purposes. It’s most convenient to call this when an idle watch, as added by GnomeDesktop.IdleMonitor.add_idle_watch(), has triggered.

Return type:

int

get_idletime()
Returns:

The current idle time, in milliseconds

Return type:

int

remove_watch(id)
Parameters:

id (int) – A watch ID

Removes an idle time watcher, previously added by GnomeDesktop.IdleMonitor.add_idle_watch() or GnomeDesktop.IdleMonitor.add_user_active_watch().