2009-06-07

Turn Off Your Laptop Display

One thing I find inconvenient about laptops is that they typically do not have a power button for the display the way standard monitors do for desktop computers. It turns out that if you have ACPI enabled in your kernel, there's an easy way to create a keyboard shortcut to turn off your laptop display.

First thing, we can test to make sure this will work by running the following command:

$ xset dpms force off

That should turn off your laptop monitor until you move the mouse or type on the keyboard. Now to assign the keyboard shortcut, we need to open the configuration editor with the following command:

$ gconf-editor

You'll want to navigate the tree view on the left to the following path: /apps/metacity/keybinding_commnads. In the right panel you'll see that it lets you assign 12 commands (numbered 1 through 12). Just pick an empty one and assign it the following value:

xset dpms force off

Next you will want to find the following path on the tree view on the left: /apps/metacity/global_keybindings. Here you will see entries named run_command_x for x between 1 and 12. You will want to find the command that you edited earlier and in the Value space, type in the shortcut you want to run this with. For example, on the Mini 9, since Sleep is mapped to Fn+1, I decided to map this to Alt+1. To do this, I used the following value:

<Alt>1

Once you do that, you can test your keyboard shortcut and then close out of the configuration editor.

See you next time.

1 comment:

  1. You can also do `xrandr --output .. --off`, I think that would be better. Annoyingly there is no --on, instead you must use --mode and re-provide the setting.

    ReplyDelete