完善背光控制,优先使用 xset 控制。完成浏览器展示

This commit is contained in:
2024-12-30 12:16:10 +08:00
parent 73571c923a
commit ff97e25a55
8 changed files with 222 additions and 39 deletions

View File

@@ -1,13 +1,24 @@
package utils
import "os"
import (
"os"
"os/exec"
)
// BlankOpen 打开屏幕
func BlankOpen() {
if found, err := exec.LookPath("xset"); err == nil {
exec.Command(found, "dpms", "force", "on").Run()
return
}
os.WriteFile("/sys/class/graphics/fb0/blank", []byte("0"), 0644)
}
// BlankClose 关闭屏幕
func BlankClose() {
if found, err := exec.LookPath("xset"); err == nil {
exec.Command(found, "dpms", "force", "off").Run()
return
}
os.WriteFile("/sys/class/graphics/fb0/blank", []byte("1"), 0644)
}