Comment 3 for bug 550054

Revision history for this message
nightflow (philchungny) wrote : Re: Power Manager Not putting Monitor to Sleep

I had this same issue with Karmic. It seems gnome-power-manager gets confused when the laptop lid is closed and an external monitor is used instead as the primary display. I wrote a script to set the monitor to standby and I run it in System,Preferences,Startup Applications.

$ cat poweroffexternalmonitor.pl

#!/usr/bin/perl
#
# Workaround to put external monitor to standby.
# gnome-power-manager seems to get confused when the laptop lid is closed
# and an external monitor is used instead as the primary display
#
# Works with Ubuntu Karmic Koala 9.10 and later
# Change 'ActiveChanged' to 'SessionIdleChanged' for earlier Ubuntu versions
#
# @author pchung
#
my $cmd = "dbus-monitor --session \"type='signal',interface='org.gnome.ScreenSaver', member='ActiveChanged'\"";

open (IN, "$cmd |");

while (<IN>) {
 if (m/^\s+boolean true/) {
  system("xset dpms force standby");
 }
}