How to determine which lightdm greeter is in use?

6,527

From a couple of quick tests, it seems the only way is to ask LightDM itself:

$ lightdm --show-config |& awk -F= '/greeter-session=/{print $2}'
kylin-greeter

I started testing with default Ubuntu, then installed lightdm-gtk-greeter and the installed kylin-greeter. In each case, it returned the correct option. For example, after editing /etc/lightdm/lightdm.conf to add greeter-session=unity, the output changed:

$ lightdm --show-config |& awk -F= '/greeter-session=/{print $2}'
unity

$ lightdm --show-config
   [LightDM]
A  backup-logs=false

   [Seat:*]
B  greeter-wrapper=/usr/lib/lightdm/lightdm-greeter-session
C  guest-wrapper=/usr/lib/lightdm/lightdm-guest-session
D  user-session=ubuntu
I  greeter-session=unity
F  xserver-command=X -core
I  autologin-guest=false
I  autologin-user=muru
I  autologin-user-timeout=0

Sources:
A  /usr/share/lightdm/lightdm.conf.d/50-disable-log-backup.conf
B  /usr/share/lightdm/lightdm.conf.d/50-greeter-wrapper.conf
C  /usr/share/lightdm/lightdm.conf.d/50-guest-wrapper.conf
D  /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
E  /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf
F  /usr/share/lightdm/lightdm.conf.d/50-xserver-command.conf
G  /usr/share/lightdm/lightdm.conf.d/60-lightdm-gtk-greeter.conf
H  /usr/share/lightdm/lightdm.conf.d/95-kylin-greeter.conf
I  /etc/lightdm/lightdm.conf

Note the source of the configuration.

Share:
6,527

Related videos on Youtube

Sergiy Kolodyazhnyy
Author by

Sergiy Kolodyazhnyy

Updated on September 18, 2022

Comments

  • Sergiy Kolodyazhnyy
    Sergiy Kolodyazhnyy over 1 year

    For those who don't know, greeter is basically the login screen. In case of Lightdm specifically, there are several versions of it:

    • unity-greeter
    • kylin-greeter
    • lightdm-gtk-greeter
    • lightdm-kde-greeter
    • lightdm-webkit-greeter
    • razorqt-lightdm-greeter

    The goal:

    I need to know how to obtain the greeter version currently in use. Scripting solutions are most welcome ( preferably python, shell scripts, perl ) but also open to C code. Ideally , the solution would work like so:

    $ ./get_greeter
    kylin-greeter
    

    Issues and failed approaches:

    • Checking process listing doesn't work. I have kylin-greeter in use right now, but pgrep -f lightdm | xargs -L 1 ps -o args --no-header -p or pgrep -f kylin | xargs -L 1 ps -o args --no-header -p return nothing that points to /usr/sbin/kylin-greeter
    • lsof -p <LIGHTDM_PID> also provides no insights - no /usr/sbin/kylin-greeter among the listing.
    • Parsing /etc/lightdm/lightdm.conf is a potential, but not ideal solution, since some flavors of Ubuntu ( such as Kylin ) won't explicitly state greeter session in that file. I would prefer something more reliable.
    • gsettings doesn't provide a reliable means of determining greeter in use either - presence of schemas for unity-greeter doesn't mean I am currently using that.
    • examining paths and methods on org.freedesktop.DisplayManager service for system bus provided no insights into what greeter is in use either.
    • WinEunuuchs2Unix
      WinEunuuchs2Unix over 7 years
      There are lots of answers here: wiki.archlinux.org/index.php/LightDM#Greeter
    • Sergiy Kolodyazhnyy
      Sergiy Kolodyazhnyy over 7 years
      @WinEunuuchs2Unix those all tell me what is available, but not what is being used currently
    • Terrance
      Terrance over 7 years
      Does this help? grep -i exec= /etc/alternatives/lightdm-greeter
    • Sergiy Kolodyazhnyy
      Sergiy Kolodyazhnyy over 7 years
      @Terrance nope, that also doesn't do it. It gives Exec=lightdm-gtk-greeter , even though I'm using kylin-greeter. I switched to lightdm-webkit-greeter to test, but it still shows the same line
    • Terrance
      Terrance over 7 years
      OK, I tried. Good luck! I hope you find the answer my friend!
    • Sergiy Kolodyazhnyy
      Sergiy Kolodyazhnyy over 7 years
      @Terrance thank you for the efforts , I do appreciate any help. I'll probably put bounty on the question in 2 days, so keep an eye on it. If you find something, feel free to post
  • Terrance
    Terrance over 7 years
    Nice find there! It is interesting that there are so many configuration files. I didn't even stop to look there. +1