LightDM: Set default user session when possible.

This commit is contained in:
Will Fancher 2018-03-04 12:29:08 -05:00 committed by obadz
parent 9b732aa7c2
commit 6b9a99e55d

View File

@ -9,6 +9,10 @@ let
xEnv = config.systemd.services."display-manager".environment; xEnv = config.systemd.services."display-manager".environment;
cfg = dmcfg.lightdm; cfg = dmcfg.lightdm;
dmDefault = xcfg.desktopManager.default;
wmDefault = xcfg.windowManager.default;
hasDefaultUserSession = dmDefault != "none" || wmDefault != "none";
inherit (pkgs) stdenv lightdm writeScript writeText; inherit (pkgs) stdenv lightdm writeScript writeText;
# lightdm runs with clearenv(), but we need a few things in the enviornment for X to startup # lightdm runs with clearenv(), but we need a few things in the enviornment for X to startup
@ -54,14 +58,13 @@ let
autologin-user-timeout = ${toString cfg.autoLogin.timeout} autologin-user-timeout = ${toString cfg.autoLogin.timeout}
autologin-session = ${defaultSessionName} autologin-session = ${defaultSessionName}
''} ''}
${optionalString hasDefaultUserSession ''
user-session=${defaultSessionName}
''}
${cfg.extraSeatDefaults} ${cfg.extraSeatDefaults}
''; '';
defaultSessionName = defaultSessionName = dmDefault + optionalString (wmDefault != "none") ("+" + wmDefault);
let
dm = xcfg.desktopManager.default;
wm = xcfg.windowManager.default;
in dm + optionalString (wm != "none") ("+" + wm);
in in
{ {
# Note: the order in which lightdm greeter modules are imported # Note: the order in which lightdm greeter modules are imported
@ -179,6 +182,14 @@ in
default session: ${defaultSessionName} is not valid. default session: ${defaultSessionName} is not valid.
''; '';
} }
{ assertion = hasDefaultUserSession -> elem defaultSessionName dmcfg.session.names;
message = ''
services.xserver.desktopManager.default and
services.xserver.windowMananger.default are not set to valid
values. The current default session: ${defaultSessionName}
is not valid.
'';
}
{ assertion = !cfg.greeter.enable -> (cfg.autoLogin.enable && cfg.autoLogin.timeout == 0); { assertion = !cfg.greeter.enable -> (cfg.autoLogin.enable && cfg.autoLogin.timeout == 0);
message = '' message = ''
LightDM can only run without greeter if automatic login is enabled and the timeout for it LightDM can only run without greeter if automatic login is enabled and the timeout for it