11

This question already has an answer here:

I am using xfce desktop in ubuntu 12.04 and added the shortcut keys in order to turn off my monitor.

The command "xset dpms force off" works fine in terminal.

But when it added in the keyboard shortcuts, the monitor turns off a second then turns on immediately.

The command "xset dpms force off" added in keyboard shortcuts

So how can I turn off the monitor using hotkeys?

marked as duplicate by Zanna, David Foerster, muru command-line Jan 27 '17 at 2:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

15

I imagine it's because you're pressing a key... I'd consider setting the command to something that waits for a second, and then runs the command:

sh -c "sleep 1 && xset dpms force off"
  • 1
    It works! Thanks a lot. And I made the command to sleep 0.1 second. 1 second is too long to turn monitor off. – zfz Nov 13 '12 at 13:04

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