小编Pin*_*ney的帖子

使用 xrandr 和 cron 作业调整亮度

编辑感谢 pa4080,我在下面的脚本中添加了一行,现在效果很好。我不完全明白如何,哦,好吧。

我想做一个 cron 工作来在一天中的不同时间调整我的亮度。在做了一些谷歌搜索和反复试验之后,我编写了以下运行良好的 bash 脚本:

#!/bin/bash
export DISPLAY=$(w $(id -un) | awk 'NF > 7 && $2 ~ /tty[0-9]+/ {print $3; exit}')

H=$(date +%H)

if (( 00 <= 10#$H && 10#$H < 07 )); then
    xrandr --output HDMI-1 --brightness .3 && xrandr --output HDMI-2 --brightness .3 && xrandr --output HDMI-3 --brightness .3
elif (( 07 <= 10#$H && 10#$H < 10 )); then
    xrandr --output HDMI-1 --brightness .5 && xrandr --output HDMI-2 --brightness .5 && xrandr --output …
Run Code Online (Sandbox Code Playgroud)

xrandr bash scripts cron brightness

6
推荐指数
3
解决办法
2194
查看次数

标签 统计

bash ×1

brightness ×1

cron ×1

scripts ×1

xrandr ×1