I like to put my displays to powersave/standby mode when I leave the computer for a while. It would be ok if it weren't for oversensitive mouse. Sometimes the driver reads in some movement that's not visible to the naked eye (the cursor, that is) and it breaks the power save. It would wait for another 10 minutes before going back to its standby.

My workaround is the following script bound to C-S-q:

xlock -startCmd 'xset dpms 2 2 2' -endCmd 'xset dpms 600 1200 1300' -mode blank -echokeys -timeelapsed +usefirst

By using xset I set the values to 2 seconds each before going to standby. It's not nice, anyway. Sometimes there are cool fortunes that I want to read before typing in the password. I could keep the cursor moving but it's cludgy. (By the way, xlock's option mousemotion doesn't help -- it just hides the cursor but the displays fire up nevertheless.)

So the question: is there a way to make displays go standby and stay there until a keyboard key is pressed? I'm running gentoo and recent Xorg, but I hope the answer doesn't have to be distro-specific.

Basically the answer can be as simple as how to enable/disable mouse within command line? It think that would do the job if DPMS doesn't know the idea.

link|improve this question

78% accept rate
1  
If it's the hardware that's the problem, then the hardware could be the solution - flip the mouse over until you want to use it. (Okay, that was sarcastic, but you get the point). – new123456 Jun 24 '11 at 17:11
Not a bad suggestion but it would still read something while being upside down :) – progo Jun 24 '11 at 17:12
Even the most sensitive optical mice won't register any movement without an object of some sort within about an inch or so of the sensor. If it's a mechanical mouse, just pop the ball out to achieve the same effect. – Shinrai Jun 24 '11 at 17:23
Eh. Let's think of something that doesn't require flipping the mouse. :) – progo Jun 24 '11 at 17:25
Nah, you're right, it's a good question (and that's why I upvoted it). But I agree with @new123456 that sometimes a mechanical solution is easier (and it may be that nobody comes through for you on this - I'm not a Linux guy so I sure can't). – Shinrai Jun 24 '11 at 17:40
feedback

1 Answer

up vote 1 down vote accepted

There's a great post by @pbm that covers this, over on the Unix SE site.

In short, first use xinput list to get the device ID for your mouse, and then use

xinput --set-prop [ID#] "Device Enabled" "0"

and

xinput --set-prop [ID#] "Device Enabled" "1"

to disable and enable the mouse.

I've just tested these here by disabling the mouse and then calling xset dpms force standby. Waving the mouse around for several seconds did nothing to disturb the screen, but pressing a single key worked fine. Using the second command then returned the mouse back to normal, including the "constant deceleration" setting that my default startup scripts set for me.

You should be able to pass these two commands to the -startCmd and -endCmd options to xlock to get what you're after.

link|improve this answer
Does perfectly the right thing! Thanks a ton :) – progo Jun 30 '11 at 7:38
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.