Description: This simple desktop file allows you to "turn off" the monitor (put it into sleep mode) as well as turning off the backlight if you own a laptop.
To install follow these instructions: If you want it to be an icon in a panel: - Open the folder where you downloaded the TurnOffMonitor.desktop file - Drag the file to the panel
If you want it to behave like a regular program that you can call from krunner (Alt+F2): - Right click the "Application Launcher" widget (the K icon in your panel) and select "Menu Editor" - Drag the TurnOffMonitor.desktop file to the category you choose.
If when you download the file it opens up in a new window on your browser instead of downloading to your computer, try the "Save page as..." option in your browser and save it somewhere where you can find it. Then follow the instructions above.
For those of you that are on KDE5, here's the shell script to lock your screen and also turn off your monitors.
#!/bin/sh
loginctl lock-session
sleep 0.5
xset dpms force off
To use this, open up notepad, copy the above code and then save it as KDE5lock.sh. Pick any name you want, just make sure it has the .sh as the file extension. Give it the permission to be executed throuh Dolphin or your prefered file manager and then either put it somewhere you can easily click on, or connect it to a keybaord shortcut. (Meta+L) is my personal preference.
edit:
Use this instead, there's no .5 second delay between the screen locking and the monitor being turned off.
#!/bin/sh
sleep 0.5
loginctl lock-session
xset dpms force off
I made a similar thing. I wrote a tiny shell script:
#!/bin/sh
sleep 0.5
xset dpms force off
And assigned it to a global hotkey ("Pause"). The sleep is needed because hitting any key turns the monitor on again and without the sleep somehow the keypress for the hotkey itself turned the monitor on again.
Yes, thats exactly how this works, i had almost the exact same script before and i assigned it a shortcut, just how you did it. But, from a user point of view, I think its easier to add it to the menu using the "Menu Editor" and once there you can configure a shortcut to launch it and that can be done graphically.
One could also create the shortcut directly using [i]khotkeys[i], but you should make sure the script never changes place, and i found that after every "cleanup" some things would stop working because I deleted the scripts... Adding it to the menu, moves the desktop file inside the .local folder, where its virtually impossible to accidentally delete it.
Glad you liked it, and yes, we are running the same code, different launcher :D
Yes, thats exactly how this works, i had almost the exact same script before and i assigned it a shortcut, just how you did it. But, from a user point of view, I think its easier to add it to the menu using the "Menu Editor" and once there you can configure a shortcut to launch it and that can be done graphically.
One could also create the shortcut directly using khotkeys, but you should make sure the script never changes place, and i found that after every "cleanup" some things would stop working because I deleted the scripts... Adding it to the menu, moves the desktop file inside the .local folder, where its virtually impossible to accidentally delete it.
Glad you liked it, and yes, we are running the same code, different launcher :D
I find this a great idea. I think it would be even better if you make a plasmoid out of it, so that one can have a "Turn off
monitor" button on the desktop.
Greetings!
Thanks nicovai! I'm glad you liked it!
If you want it to live on your desktop, try dragging the .desktop file to the desktop! An icon will appear (thats what I call KDE4 goodness!), that you can resize and do the same things you would to a plasmoid.
There was a "turn off screen and suspend" plasmoid that I used for a while, but it was a little obtrusive to my taste because you couldn't make it smaller than 200x100px, so I opted to use this approach.
Hope you can make it work the way you intend it.
Thanks!
Ratings & Comments
11 Comments
For those of you that are on KDE5, here's the shell script to lock your screen and also turn off your monitors. #!/bin/sh loginctl lock-session sleep 0.5 xset dpms force off To use this, open up notepad, copy the above code and then save it as KDE5lock.sh. Pick any name you want, just make sure it has the .sh as the file extension. Give it the permission to be executed throuh Dolphin or your prefered file manager and then either put it somewhere you can easily click on, or connect it to a keybaord shortcut. (Meta+L) is my personal preference.
edit: Use this instead, there's no .5 second delay between the screen locking and the monitor being turned off. #!/bin/sh sleep 0.5 loginctl lock-session xset dpms force off
exactly what I needed, thanks! +1
How to lock the screen too?
Simple and useful. Thanks!
I'm glad you liked it :D!
I made a similar thing. I wrote a tiny shell script: #!/bin/sh sleep 0.5 xset dpms force off And assigned it to a global hotkey ("Pause"). The sleep is needed because hitting any key turns the monitor on again and without the sleep somehow the keypress for the hotkey itself turned the monitor on again.
Yes, thats exactly how this works, i had almost the exact same script before and i assigned it a shortcut, just how you did it. But, from a user point of view, I think its easier to add it to the menu using the "Menu Editor" and once there you can configure a shortcut to launch it and that can be done graphically. One could also create the shortcut directly using [i]khotkeys[i], but you should make sure the script never changes place, and i found that after every "cleanup" some things would stop working because I deleted the scripts... Adding it to the menu, moves the desktop file inside the .local folder, where its virtually impossible to accidentally delete it. Glad you liked it, and yes, we are running the same code, different launcher :D
Yes, thats exactly how this works, i had almost the exact same script before and i assigned it a shortcut, just how you did it. But, from a user point of view, I think its easier to add it to the menu using the "Menu Editor" and once there you can configure a shortcut to launch it and that can be done graphically. One could also create the shortcut directly using khotkeys, but you should make sure the script never changes place, and i found that after every "cleanup" some things would stop working because I deleted the scripts... Adding it to the menu, moves the desktop file inside the .local folder, where its virtually impossible to accidentally delete it. Glad you liked it, and yes, we are running the same code, different launcher :D
I find this a great idea. I think it would be even better if you make a plasmoid out of it, so that one can have a "Turn off monitor" button on the desktop. Greetings!
Thanks nicovai! I'm glad you liked it! If you want it to live on your desktop, try dragging the .desktop file to the desktop! An icon will appear (thats what I call KDE4 goodness!), that you can resize and do the same things you would to a plasmoid. There was a "turn off screen and suspend" plasmoid that I used for a while, but it was a little obtrusive to my taste because you couldn't make it smaller than 200x100px, so I opted to use this approach. Hope you can make it work the way you intend it. Thanks!