Hi,

I will soon release a new distribution called Slint, based on Slackware
and Salix, cf. http://slint.fr

As Slackware, Slint ships several "light" WMs, namely blackbox, fluxbox,
fvwm, twm, windowmaker and two desktops (Xfce and KDE).

The user can either use "startx" to start a WM, or use lxdm as display
manager.

All light WMs are equipped with lxpanel 0.9.2 and also PCManFM 1.2.5.

So far, so good.

But the "Logout" function of lxsession-logout seems to be of no effect
when using a light WM.

Hence my questions:
1) How to include lxsession in the startup procedure of the WMs, both
with (xsession) and without (xinit) using a display manager?
2) Is there a way to configure lxsession so it "knows" how to logout
from _any_ window manager?

For your information I can use the attached script, modified from
https://gist.github.com/seanh/6417375 as logout command in lxdm.

I have no problem for shutdown, reboot, hibernate or suspend: only logout
(to shutdown the WM and X or go back to lxdm's greeting screen) is an
issue.

All WM have an internal command to quit accessible from their respective
root menu, but I'd really like that users be allowed to do that from
lxpanel.

Best regards,

Didier
#!/usr/bin/env python

import pygtk
pygtk.require('2.0')
import gtk
import os
import dbus


class LogoutWindow:

    def cancel(self, widget, event, data=None):
        gtk.main_quit()
        return False

#    def logout(self, widget):
#    os.system("/usr/bin/xlogout")

    def suspend(self, widget):
        bus = dbus.SystemBus()
        bus_object = bus.get_object("org.freedesktop.UPower",
                "/org/freedesktop/UPower")
        bus_object.Suspend(0, dbus_interface="org.freedesktop.UPower")

    def hinernate(self, widget):
        bus = dbus.SystemBus()
        bus_object = bus.get_object("org.freedesktop.UPower",
                "/org/freedesktop/UPower")
        bus_object.Hibernate(0, dbus_interface="org.freedesktop.UPower")


    def reboot(self, widget):
        bus = dbus.SystemBus()
        bus_object = bus.get_object("org.freedesktop.ConsoleKit",
                "/org/freedesktop/ConsoleKit/Manager")
        bus_object.Restart(dbus_interface="org.freedesktop.ConsoleKit.Manager")

    def shutdown(self, widget):
        bus = dbus.SystemBus()
        bus_object = bus.get_object("org.freedesktop.ConsoleKit",
                "/org/freedesktop/ConsoleKit/Manager")
        bus_object.Stop(dbus_interface="org.freedesktop.ConsoleKit.Manager")

    def __init__(self):

        # Create a new window.
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.set_title("Exit? Choose an option:")
        self.window.set_resizable(False)
        self.window.set_position(1)
        self.window.connect("delete_event", self.cancel)
        self.window.set_border_width(20)

        # Create a box to pack widgets into.
        self.box = gtk.HBox(False, 0)
        self.window.add(self.box)

        # Create cancel button.
        self.cancel_button = gtk.Button("Cancel")
        self.cancel_button.connect("clicked", self.cancel, "Changed me mind :)")
        self.box.pack_start(self.cancel_button, True, True, 0)
        self.cancel_button.show()

        # Create logout button.
#        self.logout_button = gtk.Button("Log out")
#        self.logout_button.connect("clicked", self.logout)
#        self.box.pack_start(self.logout_button, True, True, 0)
#        self.logout_button.show()

        # Create suspend button.
        self.suspend_button = gtk.Button("Suspend")
        self.suspend_button.connect("clicked", self.suspend)
        self.box.pack_start(self.suspend_button, True, True, 0)
        self.suspend_button.show()

        # Create hibernate button.
        self.hibernate_button = gtk.Button("Hibernate")
        self.hibernate_button.connect("clicked", self.suspend)
        self.box.pack_start(self.hibernate_button, True, True, 0)
        self.hibernate_button.show()


        # Create reboot button.
        self.reboot_button = gtk.Button("Reboot")
        self.reboot_button.connect("clicked", self.reboot)
        self.box.pack_start(self.reboot_button, True, True, 0)
        self.reboot_button.show()

        # Create shutdown button.
        self.shutdown_button = gtk.Button("Shutdown")
        self.shutdown_button.connect("clicked", self.shutdown)
        self.box.pack_start(self.shutdown_button, True, True, 0)
        self.shutdown_button.show()

#       for button in (self.cancel_button, self.logout_button,
        for button in (self.cancel_button, self.hibernate_button,
            self.suspend_button, self.reboot_button, self.shutdown_button):
            button.set_border_width(10)

        self.box.show()
        self.window.show()


def main():
    gtk.main()


if __name__ == "__main__":
    gogogo = LogoutWindow()
    main()

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Lxde-list mailing list
Lxde-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxde-list

Reply via email to