tag:blogger.com,1999:blog-4790701123467361779.post8574081784509812284..comments2023-10-21T07:30:29.418-05:00Comments on deekshith.in: An Easy Way to Turn Off Monitor on Linux and Other Operating Systems With Just a ClickAnonymoushttp://www.blogger.com/profile/04326649946471280083noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-4790701123467361779.post-11961217842744681402013-09-27T15:18:14.480-05:002013-09-27T15:18:14.480-05:00for window systems code will go like this :
#inclu...for window systems code will go like this :<br />#include <br />#include <br /><br />int main()<br />{<br /> std::cout<<"3...\n";<br /> Sleep(1000);<br /> std::cout<<"2...\n";<br /> Sleep(1000);<br /> std::cout<<"1...\n";<br /> Sleep(1000);<br /> std::cout<<"Turning monitor off\n";<br /> SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);<br /> return 0;<br />}<br />I was having hard time converting it for ubuntu. thanxKunal Krishna https://www.blogger.com/profile/06202237214255825462noreply@blogger.comtag:blogger.com,1999:blog-4790701123467361779.post-38357656715180138102013-07-09T08:03:37.474-05:002013-07-09T08:03:37.474-05:00It works like an obedient kidIt works like an obedient kidAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-4790701123467361779.post-74549993475266963832012-08-21T13:19:58.622-05:002012-08-21T13:19:58.622-05:00Dear Deekshith, your executable idea works better ...Dear Deekshith, your executable idea works better than the shell script. Thank a lot for that.<br />Here is the shell script if you want to try (put it in ~/Desktop/turn-off-monitor):<br />#!/bin/bash<br />exec xset dpms force off<br /><br />The above two lines is the shell script to do this task.<br />It works but the problem is that it always opens a dialog box asking whether to run it or not.<br />So, your approach of making an executable is better. Before I saw your post, i used to use terminal to do that.<br />Thank you.Reece Lambhttp://www.deekshith.innoreply@blogger.comtag:blogger.com,1999:blog-4790701123467361779.post-8513465848969831562012-08-21T06:06:29.194-05:002012-08-21T06:06:29.194-05:00thank you it helped me (ignore all the people crit...thank you it helped me (ignore all the people criticising you, at least you are trying to be helpful)chhttp://example.comnoreply@blogger.comtag:blogger.com,1999:blog-4790701123467361779.post-15945190307997974172012-08-20T22:53:35.129-05:002012-08-20T22:53:35.129-05:00@Anonymous
Because I do not know shell script.@Anonymous<br />Because I do not know shell script.Anonymoushttps://www.blogger.com/profile/04326649946471280083noreply@blogger.comtag:blogger.com,1999:blog-4790701123467361779.post-58056010366927041482012-08-20T21:09:13.296-05:002012-08-20T21:09:13.296-05:00Why in the name of baby jesus did you write a C pr...Why in the name of baby jesus did you write a C program just to run a system() call?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4790701123467361779.post-86785063333589172592012-08-20T13:22:18.739-05:002012-08-20T13:22:18.739-05:00cat >> turn-off-monitor
#!/bin/sh
xset dpms...cat >> turn-off-monitor<br />#!/bin/sh<br /><br />xset dpms force off<br />(Press Control-D)<br />chmod +x turn-off-monitorAnonymousnoreply@blogger.com