diff --git a/src/MainWindow.vala b/src/MainWindow.vala index fed490623..29c6a2983 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -36,29 +36,7 @@ public class Greeter.MainWindow : Gtk.ApplicationWindow { private int current_user_card_index = 0; private unowned Greeter.BaseCard? current_card = null; - private bool? _is_live_session = null; - private bool is_live_session { - get { - if (_is_live_session != null) { - return _is_live_session; - } - - _is_live_session = false; - - var proc_cmdline = File.new_for_path ("/proc/cmdline"); - try { - var dis = new DataInputStream (proc_cmdline.read ()); - var line = dis.read_line (); - if ("boot=casper" in line || "boot=live" in line || "rd.live.image" in line) { - _is_live_session = true; - } - } catch (Error e) { - critical ("Couldn't detect if running in Live Session: %s", e.message); - } - - return _is_live_session; - } - } + private bool installer_mode = false; private Gtk.EventControllerKey key_controller; @@ -408,7 +386,7 @@ public class Greeter.MainWindow : Gtk.ApplicationWindow { // If the greeter is running on the install medium, check if the Installer has signalled // that it wants the greeter to launch the live (demo) session by means of touching a file - if (is_live_session) { + if (installer_mode) { var demo_mode_file = File.new_for_path ("/var/lib/lightdm/demo-mode"); if (demo_mode_file.query_exists ()) { demo_mode_file.@delete (); @@ -453,15 +431,19 @@ public class Greeter.MainWindow : Gtk.ApplicationWindow { critical (e.message); } - // Don't need to build user cards etc in live media - if (is_live_session) { - return; - } + lightdm_greeter.notify_property ("show-manual-login-hint"); + lightdm_greeter.notify_property ("has-guest-account-hint"); if (lightdm_greeter.default_session_hint != null) { get_action_group ("session").activate_action ("select", new GLib.Variant.string (lightdm_greeter.default_session_hint)); } + // Check if the installer is installed + var installer_desktop = new DesktopAppInfo ("io.elementary.installer.desktop"); + if (installer_desktop != null) { + installer_mode = true; + } + if (lightdm_user_list.length > 0) { datetime_revealer.reveal_child = true; @@ -515,8 +497,6 @@ public class Greeter.MainWindow : Gtk.ApplicationWindow { } lightdm_greeter.notify_property ("hide-users-hint"); - lightdm_greeter.notify_property ("show-manual-login-hint"); - lightdm_greeter.notify_property ("has-guest-account-hint"); } private void add_card (LightDM.User lightdm_user) {