Control PC display with arduino

Hello, I am interested to make a project in which, when I click a button or when a sensor is active in arduino then the monitor display of the pc to be off and when the sensor is passive to be on. How can I make this ?

I have found this: How to turn off your screen using Arduino? - YouTube

Downloaded his program and added code in arduino but its not working properly.