[displaymanager] Allow configuring the preferred-greeter-list

This commit is contained in:
Adriaan de Groot 2023-02-20 20:54:34 +01:00
parent d448be1077
commit bbc9d90888
3 changed files with 14 additions and 3 deletions

View File

@ -64,6 +64,12 @@ sysconfigSetup: false
#
# greetd has configurable user and group; the user and group is created if it
# does not exist, and the user is set as default-session user.
#
# lightdm has a list of greeters to look for, preferring them in order if
# they are installed (if not, picks the alphabetically first greeter that is installed).
#
greetd:
greeter_user: "tom_bombadil"
greeter_group: "wheel"
lightdm:
preferred_greeters: ["lightdm-greeter.desktop", "slick-greeter.desktop"]

View File

@ -26,4 +26,7 @@ properties:
greeter_user: { type: string }
greeter_group: { type: string }
additionalProperties: false
lightdm:
type: object
properties:
preferred_greeters: { type: array, items: { type: string } }

View File

@ -544,6 +544,9 @@ class DMlightdm(DisplayManager):
name = "lightdm"
executable = "lightdm"
# Can be overridden in the .conf file
preferred_greeters = ["lightdm-greeter.desktop"]
def set_autologin(self, username, do_autologin, default_desktop_environment):
# Systems with LightDM as Desktop Manager
# Ideally, we should use configparser for the ini conf file,
@ -645,10 +648,9 @@ class DMlightdm(DisplayManager):
"""
greeters_dir = "usr/share/xgreeters"
greeters_target_path = os.path.join(self.root_mount_point, greeters_dir)
preferred_names = ("lightdm-greeter.desktop", )
available_names = os.listdir(greeters_target_path)
available_names.sort()
desktop_names = [n for n in preferred_names if n in available_names] # Preferred ones
desktop_names = [n for n in self.preferred_greeters if n in available_names] # Preferred ones
if desktop_names:
return desktop_names[0]
desktop_names = [n for n in available_names if n.endswith(".desktop")] # .. otherwise any .desktop