Created
November 9, 2017 17:57
-
-
Save davit312/7631ed1a131eb197ff29aa6f682d353d to your computer and use it in GitHub Desktop.
Turn off screen after timeout, script for Ubuntu.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"os/exec" | |
"time" | |
) | |
const work = 40 | |
const rest = 5 | |
func main() { | |
for { | |
time.Sleep(work * time.Minute) | |
for end := time.Now().Add(rest * time.Minute); time.Now().Before(end); { | |
exec.Command("xset", "dpms", "force", "off").Run() | |
time.Sleep(time.Second) | |
} | |
exec.Command("xset", "dpms", "force", "on").Run() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment