diff --git a/configure b/configure
index 14f18e0..3490bc7 100755
--- a/configure
+++ b/configure
@@ -13884,10 +13884,12 @@ if test -n "$GNOME_CFLAGS"; then
     { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"
  gtk+-3.0 >= 2.91.0
  gnome-keyring-1 >= 0.6.0
+ gnome-desktop-3.0
  cairo >= 1.0.0\""; } >&5
   ($PKG_CONFIG --exists --print-errors "
  gtk+-3.0 >= 2.91.0
  gnome-keyring-1 >= 0.6.0
+ gnome-desktop-3.0
  cairo >= 1.0.0") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
@@ -13895,6 +13897,7 @@ if test -n "$GNOME_CFLAGS"; then
   pkg_cv_GNOME_CFLAGS=`$PKG_CONFIG --cflags "
  gtk+-3.0 >= 2.91.0
  gnome-keyring-1 >= 0.6.0
+ gnome-desktop-3.0
  cairo >= 1.0.0" 2>/dev/null`
 else
   pkg_failed=yes
@@ -13909,10 +13912,12 @@ if test -n "$GNOME_LIBS"; then
     { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"
  gtk+-3.0 >= 2.91.0
  gnome-keyring-1 >= 0.6.0
+ gnome-desktop-3.0
  cairo >= 1.0.0\""; } >&5
   ($PKG_CONFIG --exists --print-errors "
  gtk+-3.0 >= 2.91.0
  gnome-keyring-1 >= 0.6.0
+ gnome-desktop-3.0
  cairo >= 1.0.0") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
@@ -13920,6 +13925,7 @@ if test -n "$GNOME_LIBS"; then
   pkg_cv_GNOME_LIBS=`$PKG_CONFIG --libs "
  gtk+-3.0 >= 2.91.0
  gnome-keyring-1 >= 0.6.0
+ gnome-desktop-3.0
  cairo >= 1.0.0" 2>/dev/null`
 else
   pkg_failed=yes
@@ -13943,11 +13949,13 @@ fi
 	        GNOME_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "
  gtk+-3.0 >= 2.91.0
  gnome-keyring-1 >= 0.6.0
+ gnome-desktop-3.0
  cairo >= 1.0.0" 2>&1`
         else
 	        GNOME_PKG_ERRORS=`$PKG_CONFIG --print-errors "
  gtk+-3.0 >= 2.91.0
  gnome-keyring-1 >= 0.6.0
+ gnome-desktop-3.0
  cairo >= 1.0.0" 2>&1`
         fi
 	# Put the nasty error message in config.log where it belongs
@@ -13956,6 +13964,7 @@ fi
 	as_fn_error $? "Package requirements (
  gtk+-3.0 >= 2.91.0
  gnome-keyring-1 >= 0.6.0
+ gnome-desktop-3.0
  cairo >= 1.0.0) were not met:
 
 $GNOME_PKG_ERRORS
diff --git a/configure.ac b/configure.ac
index e933a50..e5dc939 100644
--- a/configure.ac
+++ b/configure.ac
@@ -108,6 +108,7 @@ PKG_CHECK_MODULES(CANBERRA, libcanberra-gtk3 >= 0.10)
 PKG_CHECK_MODULES(GNOME, [
  gtk+-3.0 >= 2.91.0
  gnome-keyring-1 >= 0.6.0
+ gnome-desktop-3.0
  cairo >= 1.0.0])
 
 PKG_CHECK_MODULES(GDK, [gdk-3.0 >= 2.91.7])
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index 9bb0591..8766d72 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -40,6 +40,11 @@
 #include <libupower-glib/upower.h>
 #include <libnotify/notify.h>
 
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+#include <libgnome-desktop/gnome-rr.h>
+#include <libgnome-desktop/gnome-rr-config.h>
+
+
 #include "egg-console-kit.h"
 
 #include "gpm-button.h"
@@ -895,6 +900,48 @@ gpm_manager_idle_changed_cb (GpmIdle *idle, GpmIdleMode mode, GpmManager *manage
 	}
 }
 
+/**
+ * gpm_manager_ignore_lid:
+ * @manager: This class instance
+ *
+ * Check whether the computer can be used while the laptop display is not
+ * visible.  If so, we will ignore lid close events.
+ **/
+static gboolean
+gpm_manager_ignore_lid_close(GpmManager *manager)
+{
+	GnomeRRScreen *screen;
+	GnomeRRConfig *current;
+	GnomeRROutput **outputs;
+	guint i;
+	gboolean mirror_is_active, have_external_display, need_laptop_display;
+	GError *error = NULL;
+
+	screen = gnome_rr_screen_new (gdk_screen_get_default (), &error);
+	if (error) {
+		g_error_free (error);
+		return TRUE;
+	}
+
+	current = gnome_rr_config_new_current (screen, NULL);
+	mirror_is_active = gnome_rr_config_get_clone (current);
+	g_object_unref (current);
+
+	have_external_display = FALSE;
+	need_laptop_display = FALSE;
+	outputs = gnome_rr_screen_list_outputs (screen);
+	for (i = 0; outputs[i] != NULL; i++) {
+		if (!gnome_rr_output_is_connected (outputs[i]))
+			/* ignore this display */ ;
+		else if (!gnome_rr_output_is_laptop (outputs[i]))
+			have_external_display = TRUE;
+		else if (gnome_rr_output_get_is_primary (outputs[i]))
+			need_laptop_display = !mirror_is_active;
+	}
+	g_object_unref (screen);
+	return have_external_display && !need_laptop_display;
+}
+
 /**
  * gpm_manager_lid_button_pressed:
  * @manager: This class instance
@@ -950,13 +980,10 @@ gpm_manager_lid_button_pressed (GpmManager *manager, gboolean pressed)
 #endif
 	}
 
-#if UP_CHECK_VERSION(0,9,8)
-	/* are we docked? */
-	if (up_client_get_is_docked (manager->priv->client)) {
-		g_debug ("ignoring lid closed action because we are docked");
+	if (gpm_manager_ignore_lid_close (manager)) {
+		g_debug ("ignoring lid closed action due to current randr settings");
 		return;
 	}
-#endif
 
 	/* do action */
 	gpm_manager_perform_policy (manager,
