How to get LCD monitor backlight OFF with xlock
I did a search here and couldn't find this specific issue.
I would like for my desktop computer LCD monitor's backlight to turn off (the monitor is Energy Star compliant) when I initiate xlock. Sometimes it does; most often it doesn't. I've tried turning acpi and acpid on and that doesn't appear to make any difference. I run xlock with the "blank" option, just a black screen. But it's a "painted" black; you can still see the backlight on, and the power LED on the monitor remains green. When the backlight turns off, the power LED turns amber.
I have the monitor set to go to standby after ten minutes in the BIOS. Sometimes it does but more often it doesn't. Under version 9.2 Mandrake, it almost always went truly black after ten minutes. When I moved to 10.1 the other day, I started noticing the monitor backlight stayed on all the time, with rare unpredictable exceptions.
I'd just as soon leave the hard drives spinning all the time as I think it's worse for them to power up repeatedly than to go all the time. But the monitor backlight might as well be turned off when I'm away from the computer.
I believe your laptop must support either APM or ACPI and ACPI must be enabled in the kernel, otherwise it will not work...
Anyway enable DPMS
xset dpms force off
should shut off the display.
Once dpms is enabled after a boot up, KDE's own display management should also shut off the display.
It's a desktop machine, but I'll try it anyway. Always seemed funny to me that power management is aimed more at laptops than desktops--because of the finicky batteries, I suppose. (I've had a succession of outmoded laptops.)
We'll give 'er a try, and if you never see me post again, you'll know it's because the monitor went off and won't come back on and I can't afford a new one. :D
Hey, that worked!
Since I don't use KDE (I just use IceWM), I'll put the command "xset dpms force off" in the little script I use to call up xlock. That ought to do just fine. I'll also put "xset +dpms" in my .xinitrc file so it will be ready to go.
Edit, a little later: That proved to be iffy, but I found a solution that does work, by...ahem...reading the xlock man page.
This works for my desktop computer:
xlock -dpmsoff 3
The "3" is supposed to represent seconds; in actual practice it turns out on my system to be thirty seconds, which is fine.
A value of "0" is said to be "infinite," whatever that means---I think I would have to wait an infinite length of time for the monitor to go into "off" condition. Not desirable.
I tried a value of "1" and it still took 30 seconds.
But it works.
This is a good example of asking a question, getting a good answer, it turns out not quite to fit your setup, but the answer contains clues that enable you to investigate further, and in the process you not only learn something new, but you may even find the solution to your problem.
I don't know where I'd be without LinuxQuestions. (And Google.) Would I even be using a computer? Possibly not. Long live these great resources and the generous people who post here.
Works with the mouse, too
I created a custom launcher on the Gnome panel containing the command "xlock -dpmsoff 1". One click with the mouse does it. It displays a random screen saver effect for ten seconds and then the screen goes completely dark. When I touch the mouse or press a key, a login screen appears, requiring my user password to restore the Gnome GUI screen.
To get xlock to work, I first had to install David A. Bagley's xlockmore on Ubuntu 8.10, which was very easy:
sudo apt-get install xlockmore
Another way to achieve this result is with Brightside. It works great for an aging Fry's Electronics "Great Quality" RX-7335 laptop I have in the bedroom. I have it set up so that when I move the mouse cursor to the upper left corner it quickly starts the screensaver -- a blank display in my case -- but this doesn't shut off the LCD backlight immediately; in fact, the backlight only goes off after about 30 minutes, according to the power management rules. When I want to go to sleep, I want it dark now, so I defined the lower left corner of the screen as "Enter DPMS off mode" and I don't have to put up with the LCD backlight bleed-through. By the time my head hits the pillow, the room is completely dark, except for a couple of power status LEDs on the machine and my digital alarm clock.
Update: That GQ RX-7335 laptop is history now, but Brightside continues to work well for me on a Shuttle XPC box with AMD Athlon CPU and nVidia GeForce graphics card, running Ubuntu 10.04.01 LTS. Unfortunately, Brightside isn't keeping up with the changing .deb package installation model, as it puts its icons in the wrong place under /usr and doesn't create launchers in Gnome 2.30.2. A bit of manual tweaking is needed to make it conveniently accessible from the panel menu. If you're lost, you can type brightside-config at the prompt in a terminal window to bring up the configuration dialog box. You should also add /usr/bin/brightside to the startup applications so it's available every time you start the system, as Brightside's current installer doesn't do that for you. Running brightside-config starts up Brightside if it isn't already running.
|All times are GMT -5. The time now is 01:34 AM.|