Session Management plugin for LXDE

Bug #628940 reported by Compintuit
24
This bug affects 5 people
Affects Status Importance Assigned to Milestone
kupfer
New
Wishlist
Unassigned
Nominated for Master by andreylosev

Bug Description

There are plugins for the other DEs, and it'd be great if there was one for lxde, too. The command is lxsession-logout.

Changed in kupfer:
importance: Undecided → Wishlist
Revision history for this message
X (u78qir8a9-deactivatedaccount) wrote :

If you can be a bit more specific, I can put this into a plugin for you. All that is needed is something like this:

LOGOUT_CMD = ("gnome-panel-logout", "gnome-session-save --kill")

SHUTDOWN_CMD = ("gnome-panel-logout --shutdown",
        "gnome-session-save --shutdown-dialog")

LOCKSCREEN_CMD = ("gnome-screensaver-command --lock", "xdg-screensaver lock")

(the lists are multiple alternatives).

tags: added: implement-in-plugin
Revision history for this message
Bennett Kanuka (bkanuka) wrote :

I'll take a look into this. Can't promise anything because I've never written a Kupfer plugin.
Ulrik, if you could guide me or ask a more pointed question, I'm sure we could get this running pretty quickly.

Revision history for this message
Bennett Kanuka (bkanuka) wrote :

I now understand what's needed. The SHUTDOWN_CMD etc for lxde do not seem as straight forward as other DE's. we may have to revert to using more basic commands like "shutdown -r". I'll do some testing

Revision history for this message
Bennett Kanuka (bkanuka) wrote :

lxsession-logout is not a very powful command. All it does is open a window and allow the user to choose what to do next - you can't just call "lxsession-logout reboot". There should probably be an lxde bug filed against this, because that functionality would not be hard to implement.

I can only test on Lubuntu, however these are the commands youre looking for:

#LOGOUT UNIVERSAL
kill $_LXSESSION_PID

#SUSPEND LUBUNTU
dbus-send --system --print-reply --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend

#HIBERNATE LUBUNTU
dbus-send --system --print-reply --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Hibernate

#REBOOT LUBUNTU
dbus-send --system --print-reply --dest=org.freedesktop.ConsoleKit /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart

#HALT LUBUNTU
dbus-send --system --print-reply --dest=org.freedesktop.ConsoleKit /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop

Obviously these depend on dbus, ConsoleKit, and UPower. They _should_ work with any system with these installed.
AFAIK all lxsession-logout does is try these commands first, then fallback to trying with HAL.

Hope this helps. Another day I'll look into fixing lxsession-logout.

Revision history for this message
Ales Fajs (ales-fajs) wrote :
Download full text (5.0 KiB)

I've done some research based on Bennett Kanuka's post and it seems that currently there is no way to send 'Suspend/Hibernate/Restart/Shutdown' session commands in LXDE other than directly through dbus.

I've made a plugin for the LXDE environment based on these 'dbus' commands but I'm not quite satisfied with it (explained later on). It is divided into three parts / plugins:

1. session_lxde.py
2. session_lxde_laptop.py
3. session_lxde_logout.py

The first plugin ('session_lxde.py') is used for the following session management commands: Logout, Shutdown, Lock Screen and Reboot.

The second plugin ('session_lxde_laptop.py') should be used/activated instead of the first one to add support for 'Hibernate' and 'Suspend'.

Both, the first and the second plugin execute session commands without confirmation, hence the third plugin:

'session_lxde_logout.py' as a quick alternative for session command execution confirmation through standard LXDE logout menu.
(Basic keyboard usage would be: 'CTRL' + 'Space' to open Kupfer, type 'Logout' and hit 'Enter' than press and hold 'Alt' + underlined character of one of the session commands available through menu).

The menu called by the plugin is the standard LXDE logout menu (lxde-logout). Other options would be 'lubuntu-logout' for Lubuntu users and 'lxsession-logout' for a more minimalistic approach to logging out of an LXDE session.

Now I'm going to explain why I'm not quite satisfied with this plugin:

1. In order to save the changes made to kupfer settings, currently one has to either quit kupfer before 'Logout/Shutdown/Restart' or wait 60 seconds before logging out of the LXDE session for the applied changes to be saved by kupfer's internal timer/sheduler.

I know that 'session.py' is used by Gnome and Xfce envirnoments to connect tu dbus and check for receiveing session signals and to save Kupfer' settings accordingly. So I guess this would be the right place to implement a session logout check for saving Kupfer's settings under LXDE. But searching through web and a little through source I didn't manage to find out what the 'session end' signal for LXDE environment would be.

I know that it is possible to catch some sort of a signal at least for Shutdown and Restart but I don't think that the same goes for Logout, since LXDE logout only kills the session and the 'SIGTERM' signal sent to lxsession does nothing for Kupfer. Anyways, programming isn't really my area of expertise, so it would be nice if someone else would be willing to take a look at this.

2. 'session_lxde.py' and 'session_lxde_laptop.py' should be merged into one file named: 'session_lxde.py' which would basically contain everything that's currently in 'session_lxde_laptop.py' plus the implemented check for UPower's 'CanHibernate' and 'CanSuspend' properties.

If 'CanHibernate' and 'CanSuspend' properties would return 'true', than it would be possible to use the 'Hibernate' and 'Suspend' commands from Kupfer, otherwise only the usual 'Shutdown/Restart/Logout' would be possible. It would seem that the only possible way to get this info is through the following commands which return a string:

'dbus-send --system --print-reply --dest="or...

Read more...

Revision history for this message
Ales Fajs (ales-fajs) wrote :

Here's the patch mentioned in my previous post...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.