New Session Manager

For community centers we need to present to the user the amount of time that their session has left and at the same time log the user off when the session timer runs out. As a nice touch we want to warn the user as the session nears it’s end.

To achieve this we use an app indicator with a menu item with the amount of time left.

For the warnings we use the libnotify and change the icon of the app indicator too:

We also want to notify the user of how much time they have, so we add a welcome:

If the program exits or is killed, the gnome pid is also killed so the user logs off.

All of this is configurable so we can say what users should have what kind of session and what warnings:

logs: /var/log/sessions/
admin: ''
users: 01:00:00
testing: false
- message: Welcome!
description: You have %(remains)d minutes in your session.
icon: application-community
from: session-start
times: [ '00:01' ]
- message: Session Running Out
description: Your session is about to end automatically, please save all your work. %(time)d minutes remaining.
icon: gtk-quit
from: session-end
times: ['10:00', '05:00', '01:00']

For reporting we also want to log sessions, when they start, when they end and on what machine:

- {date: '2011-07-07T15:36:02.734579', message: log-started}
- &id002 {date: '2011-07-07T15:36:02.763812', message: login, session-pid: 1830, tag: started}
- &id001 {date: '2011-07-07T15:36:51.898611', message: forced, tag: end}
meta: {hostname: delen, username: doctormo}

We add the program’s .desktop file to the /etc/adg/autostart directory so it launches when gnome starts.

You can find all the code here and the ppa package here.

10 Responses to “New Session Manager”

  1. HoellP says:

    I guess this will help a lot if you need this kind of thing 😉

    In second last sentence “/etc/adg/autostart” should probably xdg, or not?

  2. Matt Trudel says:

    Amazing work! Thanks so much for doing this!

    This tends to be a recurring question in various circles: “I manage a community center’s computer systems, how can I have guest sessions time out automatically”, and now we have a functional and aesthetic way of doing this, that doesn’t depend on timeoutd which doesn’t appear to be maintained anymore.

  3. razvi_me says:

    Nice work, but, what about Natty (PPA package)?

  4. doctormo says:

    Razvi – Currently building for lucid, natty and oneric.

  5. pacho says:

    Would be nice to get this ported (and maybe upstreamed) to Gnome 3 😀

    Thanks a lot

  6. […] The Lab Session Manager is a indicator which times how long you can be on the computer for, notifies you when you’re running out of time and then logs you off when your time is over. It replaces the old and unmaintained timed functionality with a modern, gtk based system tray icon and logging functionality for generating reports about who is using the computer for how long. See previous blog post here. […]

  7. EtienneG says:

    Very cool stuff indeed!

    Martin, one feature that would be nice to have is to timeout idle session, like timeoutd currently does. That would also be useful in lab situation (or shared computers) where users do not have a hard limit set for their session, but where we would like to shut off the sessions of users who would not have logged off properly before leaving. That’s actually a very common use-case. Just a suggestion.



  8. doctormo says:

    It’s a good suggestion EtienneG, and you would do me a great favour to write it down into a bug report over here:

    This allows me to keep track of everything and I can get to it in good time. 🙂