1. Session Presence Manager
1.1. "A screencast is worth a thousand words"
1.2. Overview
The idea behind Session Presence Manager is to provide a central resource for applications to query when interested in the user's presence status in the current desktop session.
1.3. Rationale
1.3.1. The Problem
Leaving my computer used to mean pressing the "pause" key on my keyboard to pause Rhythmbox, and then Ctrl+Alt+L to lock my screen. In actual fact, all I wanted to do was tell my computer that "I am leaving, do what I want you to do when I leave."
1.3.2. "Why not some clever combination of GNOME Screensaver and Galago?"
GNOME Screensaver currently exposes information on whether it deems the session to be "idle", but has no capacity to detect if you are "busy". Galago exposes Instant Messaging-based information about yourself (via the "Me" person). Not only may these be entirely inconsistent with each other, but either one could just be simply missing. (For example, if you're not using any IM applications (Gaim/Gossip/Telepathy) at the time, should a user still be deprived of this functionality?)
Besides, simply having applications query just one resource rather than two is an obvious benefit.
1.4. "Status"
A status consists of two things: a tuple of well-known status identifiers that identify the nature of the status ("ID"), and a user-provided description ("Description"). These are sent over the bus together in both a response to a GetStatus method call and a StatusChanged signal.
1.4.1. Status IDs
Presence statuses are identified by a sequence of strings that describe the nature of the status in increasing levels of detail. This allows applications to only pay attention to as much detail as they are interested in. Examples include:
- ("present") meaning "I'm here"
- ("present", "engaged") meaning "I'm here, but I'm busy"
- ("absent") meaning "I'm not here"
- ("absent", "temporary") meaning "I'll be right back"
- ("absent", "extended") meaning "I'm away for a while"
1.4.2. Status Descriptions
Of course, these are of no use to machines, but your friends might like to know that you are "at the shops". These are only apparently immediately useful for IM applications. User descriptions are UTF-8 strings.
2. Core Components
2.1. Daemon
The Daemon keeps track of session presence and is responsible for emitting StatusChanged signals over the Session Bus when appropriate. Any client is able to request the current status at any time with the GetStatus method, or set it with the SetStatus method.
2.2. GNOME Client
This simple client is a frontend designed for GNOME. It currently adds a status icon to the notification area, which upon clicking reveals a small window with three buttons, "Here", "Busy" or "Away". Clicking these buttons sets the user presence on the daemon, with hardcoded example user status descriptions.
This listens to StatusChanged signals in order to update its own display.
3. Auxiliary Components
3.1. Rhythmbox Plugin
- Adds "Pause When Away" UI and GConf option
3.2. Gossip
- Glue app included in 0.0.2
- Supports "available", "busy" and "away" statuses, complete with user description as of 0.0.4
- Need to dissolve this functionality into Gossip's main code and add UI for enabling/disabling automatic status updates. There is a case for disabling this functionality, as some users will be concerned with privacy.
3.3. GNOME Screensaver
- Integrated with a "glue" program for now, by disabling idle detection (through the config UI) and having this glue activate/deactivate the screensaver via DBus when appropriate.
- If we activated the screensaver this way, then a deactivation of the screensaver implies a return of the user to the session. Screensaver can request this change in presence itself, removing the need for the user to otherwise inform the Daemon of a return.
- Eventually, we need to strip out the idle detection from GSS and put all of this into the Daemon itself.
- Need to provide DBus API compatibility with legacy apps that request idleness from Screensaver Daemon. It would be simple to proxy the query to SPM
4. Third-party Support
4.1. BMP
MiloszDerezynski has added preliminary support to BMP current SVN (http://beep-media-player.org) that more-or-less does the same as the Rhythmbox plugin.
5. Future
5.1. Auto-Away
We can pull the idle detection out of GNOME Screensaver and into the Daemon for this. I think this means that we will be using the XScreenSaver API.
5.2. Screensaver
Either GNOME Screensaver needs a lot of butchering, or a new screensaver needs to be written. I'll provide more details on this when I'm less tired.
5.3. Library
Eventually, the protocol will become too complicated to keep using without a library. So a library that deals with obtaining some kind of SessionPresenceManager object, and having PresenceStatus objects passed around instead would be useful.
5.4. Console Kit
http://people.freedesktop.org/~mccann/doc/ConsoleKit/ConsoleKit.html
ConsoleKit likes to be informed of whether the session is "idle". Would it be safe to consider the session to be "idle" when the user is declared "absent"? What are the implications of ConsoleKit's Session idleness? (Need to speak to Jon about this.)
Example code: http://gitweb.freedesktop.org/?p=ConsoleKit.git;a=blob;hb=HEAD;f=src/test-fus
Stolen from: http://bugzilla.gnome.org/show_bug.cgi?id=423829
6. THE CODE!
Run the Daemon (daemon.py), the GNOME Client (gnome-client.py), the GNOME Screensaver Glue (gnome-screensaver-glue.py) and the Gossip Glue (gossip-glue.py) with "python $SCRIPT.py". The Rhythmbox plugin can be placed in ~/.gnome2/rhythmbox/plugins.
7. Discussion
its nice to start a page with a brief intro what this is about. Maybe also add a category -- ThiloPfennig 2007-03-29 11:04:13