LXSession

From LXDE.org
Jump to: navigation, search
LXSesssion
Developer LXDE Team
Latest version 0.5.2 (from 29 Nov. 2014)
Genre Session Manager
License GNU General Public License
Website lxde.org

LXSession is the standard session manager used by LXDE. LXSession automatically starts a set of applications and sets up a working desktop environment. Moreover, It's desktop-independent and can be used with any window manager.

NB: Some options are only available on 0.4.9.X or above.

Compilation flags

  • "--enable-man" : Generate man pages
  • "--enable-more-warnings" : Enable more compilation warning at build time
  • "--enable-gtk3" : Compile with GTK3 when the component is compatible (incomplete)
  • "--enable-buildin-clipboard" : Add a build-in support for clipboard functionalities, using GTK2
  • "--enable-buildin-polkit" : Add a build-in support for a polkit agent (based on GTK)
  • "--enable-debug" : Enable more debug
  • "--enable-gtk" : Enable GTK+ programs and compilation. Pass --disable-gtk to build without any GTK+ component (useful if you want lxsession on a Qt environnement).

Runtime arguments

  • --session or -s : Specify the session name (use for configuration, settings, log files ...). Default to LXDE
  • --de or -e : Specify the desktop environment name to use for desktop files (such as LXDE, GNOME, or XFCE).
  • --reload or -r : Reload configurations (for Xsettings daemon).
  • --noxsettings or -n : Disable Xsettings daemon support.
  • --noautostart or -a : Disable the autostart of applications (window-manager mode only)
  • --compatibility or -c : Specify a compatibility mode for settings (only razor-qt supported)

Configuration files

The config files of LXSession are stored in ~/.config/lxsession/<Profile Name>

If the config files are missing, LXSession loads system-wide config in /etc/xdg/lxsession/<Profile name> instead.

Note: If no -session has been passed on the command line to lxsession, the default profile name is LXDE.

Dbus interface

All settings are available via Dbus, using the Dbus interface org.lxde.SessionManager /org/lxde/SessionManager org.lxde.SessionManager There are several group of methods, which reflect the groups of the keyfile. All settings have 2 keys (key1/key2), the first one (level1) is the main one, the second one (level2) is linked to the first one and can be empty, depending of the settings. Example : composite_manager/command is the settings which contains the name of the executable to launch the composite manager. composite_manager/autostart is the one to manager the autostart of composite_manager

To retrieve all the settings, use the ***Support method, which retrieve the list of available options. To have the details of level2 settings available for a level1 setting, use ***SupportDetail method.

Type available for methods :

  • Session
  • Dbus
  • Environment
  • Keymap
  • Proxy
  • Security
  • State
  • Updates
  • XRandr
  • Xsettings
  • a11y

Methods available for all type (replace *** by the type you want (such as Session, Dbus ...) :

  • ***Get (key1, key2) : Retrieve the setting for key1/key2
  • ***Set (key1, key2, value_to_set): Save the setting for key1/key2
  • ***Support () : List all the options available
  • ***SupportDetail (lvl1) : List all the level2 options for level1 setting lvl1.
  • ***Activate () : Launch the option (available for all type of method except Session)

Special methods:

  • SessionLaunch (command) : Launch the application (command is the key1 setting of the application to launch)

Session Manager methods:

  • CanShutdown
  • Logout
  • RequestReboot
  • RequestShutdown
  • Shutdown
  • ReloadSettingsDaemon

Options and settings

All options are available on the desktop.conf.example : http://lxde.git.sourceforge.net/git/gitweb.cgi?p=lxde/lxsession;a=blob;f=data/desktop.conf.example;hb=HEAD

Custom configuration files

You can use custom configuration files for some applications. LXsession will automatically copy them on the right place to be used by the applications. The configuration of those files are done in conffiles.conf, in /etc/xdg/lxsession/<profile>/ or ~/.config/lxsession/<profile>/.

Applications and binaries

  • lxclipboard : Application to enable a clipboard support, using GTK.
  • lxlock : Application to lock the screen, using external applications
  • lxpolkit : Polkit agent
  • lxsession-default : Wrapper around Dbus method to launch applications defined in lxsession configuration file.
  • lxsession-default-apps : Configuration application for lxsession (mostly for debugging purposes).
  • lxsession-edit : Old configuration application for lxsession
  • lxsession-utils : Misc utilities for lxsession
  • lxsettings-daemon : Xsettings daemon

Autostarted applications using lxsession

Lxsession manages the application which are started on login. It's handle by several elements

Settings

You can enable, disable partly, or disable completely autostared application using the settings "disable_autostart", with different value :

  • all : disable all applications (home, system, specify in this config file)
  • config-only : disable applications from home and system (start only the ones in the desktop.conf config file)
  • no : autostart all applications

Using "all" and "config-only" will disable autostared applications from the 2 above methods.

autostart configuration file

This file stores the commands that will be executed at the beginning of the session. It is not a shell script, but each line represents a different command to be executed. If a line begins with @, the command following the @ will be automatically re-executed if it crashes. Lines beginning with # are comments.

Commands globally executed are stored in the /etc/xdg/lxsession/<profile>/autostart file, and in addition, other commands can be locally specified in the ~/.config/lxsession/<profile>/autostart file. If both files are present, only the entries in the local file will be executed.

Exactly how autostart files are parsed, as of LXSession 0.4.9.2, is given by the following code in autostart.vala:

while ((line = dis.read_line (null)) != null)
{
    string first = line[0:1];

    switch (first)
    {
        case ("@"):
            var builder = new StringBuilder ();
            builder.append(line);
            builder.erase(0,1);
            string[] command = builder.str.split_set(" ",0);
            AppType app = { command[0], command, true, "" };
            app_list.add (app);
            break;
        case ("#"):
            /* Commented, skip */
            break;
        default:
            string[] command = line.split_set(" ",0);
            AppType app = { command[0], command, false, "" };
            app_list.add (app);
            break;
    }
 }

Notice that lines are split on space characters, but no form of escaping or quoting is supported, nor are multi-line commands. So if you need, e.g., a command with a space in one of its arguments, put it in a shell script and invoke the shell script from the autostart file.

autostart directories

LXSession supports freedesktop.org Autostart spec. Put *.desktop files of those applications in ~/.config/autostart, and they will get executed when the session starts.

Important note:

Some gnome applications have the "OnlyShowIn=GNOME" key in their *.desktop files. That key means 'only load this application in GNOME' and it prevents the application from being loaded in other desktop environments. Actually, most of those applications can work well under other desktops, but sometimes they claim they are GNOME-only.

If you cannot get an application automatically started and you already have a .desktop file for it in the autostart directory, then check the setting of the 'OnlyShowIn' key. Try commenting it out or removing the key. If the application still works ok then it's not really GNOME-specific - file a bug report for that application to its author and packager. As an example, the NetworkManager Applet (nm-applet) has the setting "OnlyShowIn=Gnome", but it works fine in LXDE. To make it autostart, just comment out or delete "OnlyShowIn=Gnome" in your ~/.config/autostart/nm-applet.desktop. If you are using different desktop environments on different sessions, and wish to use NetworkManager in LXDE, XFCE and Gnome, but not in KDE, you might want to add "OnlyShowIn=Gnome;XFCE;LXDE;" and/or "NotShowIn=KDE;"

Old LXSession and LXSession Lite (before 0.4.9.X)

LXSession Lite is an older package name which is no longer used. LXSession was intended to support X11 session management, but the implementation was buggy and rarely used. As of version 0.4.4, there is still no support for X session management.

A lightweight, stripped down version without X session management was developed in parallel, named LXSession Lite, and still exists in repos for some older distros. In those cases, it is a suitable replacement for LXSession. LXSession Lite was renamed LXSession beginning at 0.3.8.

Main config files used by LXSession Lite

autostart

This file stores the commands that will be executed at the beginning of the session. It is not a shell script, but each line represents a different command to be executed. If a line begins with @, the command following the @ will be automatically re-executed if it crashes.

Commands globally executed are stored in the /etc/xdg/lxsession/<profile>/autostart file, and in addition, other commands can be locally specified in the ~/.config/lxsession/<profile>/autostart file. If both files are present, all the entries in both files will be executed.

config

This file stores some configuration options

Main config file used by LXSession (deprecated)

default

default settings

In the future versions, LXSession will use the same config files as LXSession Lite.

Automatically start some applications on login

Both LXSession and LXSession Lite support freedesktop.org Autostart spec. Put *.desktop files of those applications in ~/.config/autostart, and they will get executed when the session starts.

Important note:

Some gnome applications have the "OnlyShowIn=GNOME" key in their *.desktop files. That key means 'only load this application in GNOME' and it prevents the application from being loaded in other desktop environments. Actually, most of those applications can work well under other desktops, but sometimes they claim they are GNOME-only.

If you cannot get an application automatically started and you already have a .desktop file for it in the autostart directory, then check the setting of the 'OnlyShowIn' key. Try commenting it out or removing the key. If the application still works ok then it's not really GNOME-specific - file a bug report for that application to its author and packager. As an example, the NetworkManager Applet (nm-applet) has the setting "OnlyShowIn=Gnome", but it works fine in LXDE. To make it autostart, just comment out or delete "OnlyShowIn=Gnome" in your ~/.config/autostart/nm-applet.desktop. If you are using different desktop environments on different sessions, and wish to use NetworkManager in LXDE, XFCE and Gnome, but not in KDE, you might want to add "OnlyShowIn=Gnome;XFCE;LXDE;" and/or "NotShowIn=KDE;"

Logging Out

To log out from the session you can run the command lxsession-logout. This will show you a dialog asking if you want to shutdown, reboot, change session, etc.

External Link