Is there any way to make a hotkey turn the screen off?
Solution 1:
If I understood well your question, you could use this commmand
xset dpms force off
In your settings, go to keyboard, shortcut, click on plus, write the name you want and past the command I just wrote, click on the new short cut and use the combination or key you want to use
Solution 2:
Custom shortcuts to do this with newer versions of Ubuntu (e.g. 16.04) seems to require a delay from pressing the key combination to running the command. The simplest solution is to modify the shortcut command using sh
.
Go to System Settings... | Keyboard | Shortcuts | Custom Shortcuts
. Create a new custom shortcut and in Command
put:
sh -c 'sleep 0.3 && xset dpms force off'
You can change the delay but I found 0.1s was not quite enough sometimes.
Solution 3:
The command is xset dpms force off
Just create a keyboard shortcut for it. Go to keyboard->shortcuts....go to custom shortcuts
.....& then click on the +
icon to create a new shortcut.
Then assign the above & assign custom key combination.
DONE!