@Sebastien Ok. I found some fault in the old patch.
suspend_on_lid_close (GsdPowerManager *manager) { + if (manager->priv->inhibit_lid_switch_action) + return FALSE; + return !external_monitor_is_connected (manager->priv->rr_screen); } @@ -1242,6 +1247,26 @@ restart_inhibit_lid_switch_timer (GsdPow } static void +setup_lid_closed_action (GsdPowerManager *manager) +{ + GsdPowerActionType policy; + + if (up_client_get_on_battery (manager->priv->up_client)) { + policy = g_settings_get_enum (manager->priv->settings, "lid-close-battery-action"); + } else { + policy = g_settings_get_enum (manager->priv->settings, "lid-close-ac-action"); + } + + if (policy == GSD_POWER_ACTION_NOTHING) { + inhibit_lid_switch (manager); + manager->priv->inhibit_lid_switch_action = TRUE; + } else { + uninhibit_lid_switch (manager); + manager->priv->inhibit_lid_switch_action = FALSE; + } +} + The issue was: Every-time lid state is changed, "setup_lid_closed_action" is performed but it doesn't take account whether external monitor is connected or not and automatically uninhibit the lid_switch & hence even if "suspend_on_lid_close" = false; it can't work as we already performed "uninhibit_lid_switch (manager)" I slightly modified it: + + if (policy == GSD_POWER_ACTION_NOTHING) { + inhibit_lid_switch (manager); + manager->priv->inhibit_lid_switch_action = TRUE; + } else { + if (external_monitor_is_connected (manager->priv->rr_screen)) { + inhibit_lid_switch(manager); + manager->priv->inhibit_lid_switch_action = TRUE; + } else { + uninhibit_lid_switch (manager); + manager->priv->inhibit_lid_switch_action = FALSE; + } + } +} I am testing this now. I will reply here soon. -- You received this bug notification because you are a member of Desktop Packages, which is subscribed to gnome-settings-daemon in Ubuntu. https://bugs.launchpad.net/bugs/1716160 Title: System goes to sleep with external monitor and lid closed after login Status in gdm3 package in Ubuntu: Invalid Status in gnome-settings-daemon package in Ubuntu: Fix Released Status in gnome-shell package in Ubuntu: Invalid Status in gdm3 source package in Artful: Invalid Status in gnome-settings-daemon source package in Artful: Fix Released Status in gnome-shell source package in Artful: Invalid Bug description: Using a laptop with lid closed and an external monitor, you can boot. Bios will show on the external monitor, as well as gdm when boot is finished. You can then choose a user and type in your password, which is accepted. But then, system goes to sleep (as the lid is cloesd I guess). Going out of sleep with the power button shows the gnome shell. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/gdm3/+bug/1716160/+subscriptions -- Mailing list: https://launchpad.net/~desktop-packages Post to : desktop-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~desktop-packages More help : https://help.launchpad.net/ListHelp