页次: 1
每次合盖睡眠后,再唤醒时屏幕亮度都会设成最亮。。。需要手动调回去,很烦。。。。
我写了调整亮度的脚本,每次调整亮度时会将调整后的亮度记录下来,然后从这个文件中获取上次调整后的亮度,方便恢复亮度
我想在每次唤醒后执行这个脚本,按照wiki上的指示,在/usr/lib/systemd/systemd-sleep下建立了以下文件:
#!/bin/sh
case $1 in
pre) ;;
post)
bright=`cat /home/corona/.brightness`
echo "`date`:Brightness is ${bright}."
sleep 3
xbacklight -set $bright
if test $? -eq 0; then
echo "Brightness Successfully Recoverd."
else
echo "Brightness Failed to Recover."
fi
;;
esac
但是并没有用。。。用
journalctl -b -u systemd-suspend.service
查看日志:
Oct 25 15:34:04 corona systemd-sleep[16557]: Entering sleep state 'suspend'...
Oct 25 15:34:13 corona systemd-sleep[16557]: System returned from sleep state.
Oct 25 15:34:13 corona systemd-sleep[16768]: Mon Oct 25 03:34:13 PM CST 2021:Brightness is 19.733525.
Oct 25 15:34:13 corona systemd-sleep[16775]: RANDR Query Version returned error -1
Oct 25 15:34:13 corona systemd-sleep[16768]: Brightness Failed to Recover.
Oct 25 15:34:14 corona systemd[1]: systemd-suspend.service: Deactivated successfully.
Oct 25 15:34:14 corona systemd[1]: Finished System Suspend.
Oct 25 15:35:53 corona systemd[1]: Starting System Suspend...
Oct 25 15:35:53 corona systemd-sleep[17440]: Entering sleep state 'suspend'...
Oct 25 15:35:59 corona systemd-sleep[17440]: System returned from sleep state.
Oct 25 15:35:59 corona systemd-sleep[17600]: Mon Oct 25 03:35:59 PM CST 2021:Brightness is 19.733525.
Oct 25 15:36:02 corona systemd-sleep[17770]: RANDR Query Version returned error -1
Oct 25 15:36:02 corona systemd-sleep[17600]: Brightness Failed to Recover.
Oct 25 15:36:02 corona systemd[1]: systemd-suspend.service: Deactivated successfully.
Oct 25 15:36:02 corona systemd[1]: Finished System Suspend.
有大佬知道这是什么情况吗?
离线
呃,你不应该检查为什么亮度会变最亮么?
看起来是 xbacklight 想访问 X 服务器但是你把它作为系统服务运行,没有 DISPLAY 变量等信息,它访问不到。
离线
我之前也出现了再次打开屏幕亮度自动最亮的情况,具体为“acpi_backlight”服务为Error。
当时参考了ArchWiki上Backlight页面 ,在引导时自己手动设置kernel parameters,添加“acpi_backlight=video”,屏幕亮度恢复如常。
离线
呃,你不应该检查为什么亮度会变最亮么?
看起来是 xbacklight 想访问 X 服务器但是你把它作为系统服务运行,没有 DISPLAY 变量等信息,它访问不到。
请问该如何检查为何变量呢?
离线
页次: 1