LightDM custom event actions

Custom event handler for the Light Display Manager (LightDM)
(c) Copyright 2013 TJ <ubuntu@iam.tj>
Licensed under the terms of the GNU General Public License version 3

Current version: 1.0

Introduction

LightDM can execute custom scripts at certain times in its lifecycle. They are:

The custom scripts are run as the root (uid 0) user.

This package allows easy integration of one or more scripts for each event.

Download

The latest version can always be downloaded from lightdm-custom-events_latest.tar.gz.

 $ wget https://iam.tj/projects/lightdm-custom-events/lightdm-custom-events_latest.tar.gz

Installation

Create the directory

 sudo mkdir -p /usr/local/lib/lightdm

Copy or extract this package's files and directories into that location:

 sudo tar -xzf lightdm-custom-events_${VERSION}.tar.gz -C /usr/local/lib/lightdm/

Ensure they are owned by root and the shell scripts are executable:

 sudo chown -R root:root /usr/local/lib/lightdm
 sudo chmod -R u+x,g+x /usr/local/lib/lightdm/custom-event.sh

Add the script event entries to the "[SeatDefaults]" section of

/etc/lightdm/lightdm.conf

display-setup-script=/usr/local/lib/lightdm/custom-event.sh display
greeter-setup-script=/usr/local/lib/lightdm/custom-event.sh greeter
session-setup-script=/usr/local/lib/lightdm/custom-event.sh session
session-cleanup-script=/usr/local/lib/lightdm/custom-event.sh cleanup

Problems

If lightdm fails to load after installing a script check the lightdm log file for information on the script that failed and error code.

/var/log/lightdm/lightdm.log

Instructions

The base directory for custom scripts is /usr/local/lib/lightdm/

Common environment variables can be placed in the file

lightdm-environment

These variables can be sourced by each script that requires them.

There is one master script in the base directory which handles all events:

custom-event.sh

It expects its first argument to be the event being processed:

These will be executed by lightdm when the associated event occurs. These scripts look for the user's custom scripts in their associated sub-directories.

Within the base directory are 4 sub-directories which can contain zero or more of the user's custom script(s):

 display.d/
 greeter.d/
 session.d/
 cleanup.d/

When looking for user scripts only files ending ".sh" and having execute permissions will be tried. Scripts will be executed in alpha-numeric name order. Files named 01-... will be exected before 07-... and so on.

This package ships with an example environment and 2 (non-executable) scripts that disable a laptop touchpad whilst showing the greeter and re-enable the touchpad once the user session starts. With modifications to match the specific input device, these scripts could be used on touch-screen devices to disable touchscreen input whilst the greeter is displayed (to avoid false inputs).

To discover the names of the X input devices, within the X session, at a terminal run:

$ xinput list

To discover the names of the properties that can be accessed on a specific device do:

$ xinput list-props "$DEVICE"

where $DEVICE is the name of the device surrounded by double-quotes.

In the example contained in this package the name of the device is stored in a bash shell array variable which is read into (sourced using the dot operator) each script that needs it.

You must edit that entry to match the device name you wish to control.