Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm experimenting with the webkit greeter for lightdm. Ubuntu 13.10 64 bits. I want to learn to create my own themes. I noticed that the default theme does not show a language select button or a session type select button. With the unity-greeter I can choose to start Unity or Gnome 3. Recently I started to prefer Gnome 3, that means that the webkit greeter is unusable to me right now as I'm forced to start with Unity when I want Gnome 3.

Is It possible to add a session type button to a webkit-greeter theme? How? Must I edit the default theme files to show the button?

share|improve this question
up vote 1 down vote accepted

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 + '">' + + '</option>');
    document.write('<option value="' + session.key + '">' + + '</option>');

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);
share|improve this answer
Thank you for that code. I learned a lot about how the greeter works. If I understand correctly that code, the session list will be placed right above the user list, and its starting value will be always the default_session at each system boot, and its last selected value will be maintained for the next user except when explicitly changed. Depending of what I can get from the lightdm namespace/object I will try to get a behavior similar to the unity-greeter that remembers the last session chosen by each user. – Hatoru Hansou Feb 2 '14 at 17:45
@HatoruHansou That is partially correct. The default value will actually always be the default-session key in /etc/lightdm/lightdm.conf, however the user's session choice is updated correctly. I thought I'd start with something simple, but it shouldn't be too hard to extend it to have per-user sessions. You should be able to get the session key from the user object as user.session, and use that to compare instead of lightdm.default_session. – Jason Conti Feb 2 '14 at 17:57
Thank you for clarify. And user.session is definitely what I'm after. – Hatoru Hansou Feb 2 '14 at 18:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.