If you look at lightdm-webkit-greeter.c in the source code, there are all sorts of interesting values we can get at from webkit. For a quick and dirty method to add a session selection dropdown to the default theme I did the following (this could definitely be expanded and improved upon):
In the default index.html, right above the line that writes the user list to the greeter:
document.write('<table id="user_table" style="margin: auto;">');
I added some code to write out the session selector:
document.write('<select id="session_list">');
for (i in lightdm.sessions)
{
session = lightdm.sessions[i];
if (session.key == lightdm.default_session)
document.write('<option selected="selected" value="' + session.key + '">' + session.name + '</option>');
else
document.write('<option value="' + session.key + '">' + session.name + '</option>');
}
document.write('</select>');
The value attributes aren't really necessary in this code, I was going to use them to select the session, but decided to use the index instead. The other change is to the authentication_complete() function. In the default code we have:
if (lightdm.is_authenticated)
lightdm.login (lightdm.authentication_user, lightdm.default_session);
So it always uses the default_session key. We want to instead use the selected session, so we can do something like:
if (lightdm.is_authenticated)
{
session_list = document.getElementById('session_list');
session = lightdm.sessions[session_list.selectedIndex];
lightdm.login (lightdm.authentication_user, session.key);
}