Turn Off The Monitor From Your Remote

One of the big disadvantages of using a standard PC monitor as your screen for MythTV is that when you're done watching it, you have to get up to go physically press the power button to turn it off.

Well, no more. Ian Forde has come up with a great solution to the problem. Here is a script and lirc configuration that will let you map a button on your remote to power off your monitor from using the remote control. Many people would map this to the power button on the remote.

First, create the following shell script:

/usr/local/bin/monitorpowerbutton.sh

#!/bin/bash

STATUS=`xset -q | grep "Monitor is" | awk '{print $3}'`

if [ "${STATUS}" = "On" ]
then
   xset dpms force off
else
   xset dpms force on
fi
exit 0

Running that script should toggle your monitor in and out of power save mode. Test it to make sure it works before we complicate things by mapping it to a remote button.

Now, it's time to link it to your remote, by adding an entry in your .lircrc file. You will need to map the button to the button on your own remote.

# Red Button
begin
prog = irexec
button = Red
repeat = 4
config = /usr/local/bin/monitorpowerbutton.sh
end 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Don't forget irexec

Dennis Hand, the nice guy who puts together the MythDora Linux distribution sent me and email. I figured I'd just add it as a comment and give him credit rather than weave it into the existing page.

"I'm adding the monitor button power off script to the new build [of MythDora]. I noticed on your site that it requires irexec but no mention making sure that it's running. This may throw some people off. You may want to update the instructions to have irexec started first."

Thanks Dennis.

What do you mean by starting

What do you mean by starting irexec first. I followed the directions above and nothing happend.... I think it may have something to do with this.

irexec

irexec is an application that must be running on the computer for this to work. For testing purposes, try running "irexec" on the command line. You can also add it to one of the startup scripts. Depending on your system and distribution, it may already have a startup script.

irexec not running

i tried to run the command 'irexec' and got this error: jack@mythTVpc:~/scripts/Linux/remote$ irexec

irexec: could not connect to socket

irexec: Connection refused

anybody know what's wrong?

info:

using ubuntu 7.04

/etc/init.d/lirc is running

tried w/ sudo

dmesg | tail --> [13356.608986] lirc_dev: IR Remote Control driver registered, at major 61

[13356.611779] lirc_streamzap: no version for "lirc_unregister_plugin" found: kernel tainted.

[13357.505919] lirc_streamzap[-1]: Streamzap, Inc. Streamzap Remote Control on usb2:2 attached

[13357.505928] lirc_dev: lirc_register_plugin: sample_rate: 0

[13357.506957] usbcore: registered new interface driver lirc_streamzap

[13357.506965] lirc_streamzap $Revision: 1.21 $ registered

The reason the computer

The reason the computer monitors didn't have any remote so far was because we usually sit close to our computers, we don't necessarily need a remote for that. The fact that a monitor has a remote control system won't convince me to buy it... there are other technical specifications that I consider when making a buying decision.