编写了一个调整外接显示器亮度的脚本

从Intel 显示驱动 后记继续讨论:

我第一次知道原来外接的显示器亮度也能调整,心血来潮写了个脚本。
放心,包不是ai生成的,ai写不出这么烂的代码。 :tieba_087:

脚本绑个键即可像笔记本一样用快捷键调亮度了,ddcutil运行比较慢所以要考虑自行增加步长。

一定要自行编辑开头的min/max变量
限制的最大值最小值自行探索,搞坏显示器我不负责啊,不然就像我这个笨比一样。 :sob:

#!/bin/bash

min=0
max=43
cfg=$HOME/.config/brightness

if ! type ddcutil notify-send 2>&1 > /dev/null
then
	echo 缺少 ddcutil 或者是 notify-send 命令。
fi

if ! [ -e $cfg ]
then
	echo 0 > $cfg
fi
case $1 in
	+)
		if [ -z $2 ]
		then
			let b=$(cat $cfg)+1
		else
			let b=$(cat $cfg)+$2
		fi
		if ! [ $b -le $max ]
		then
			b=$max
		fi
		if ! [ $min -le $b ]
		then
			b=$min
		fi
		ddcutil setvcp 10 $b
		notify-send "亮度: $b"
		echo $b
		echo $b > $cfg
			
		;;
	-)
		if [ -z $2 ]
		then
			let b=$(cat $cfg)-1
		else
			let b=$(cat $cfg)-$2
		fi
		if ! [ $b -le $max ]
		then
			b=$max
		fi
		if ! [ $min -le $b ]
		then
			b=$min
		fi
		ddcutil setvcp 10 $b
		notify-send "亮度: $b"
		echo $b
		echo $b > $cfg
		;;
	*)
		echo "使用方法:"
		echo "$0 + [ 增加的亮度值 ]"
		echo "$0 - [ 减去的亮度值 ]"
		echo "若不填写值,则按1的步长进行加减。"
		;;
esac

10 个赞

原来亮度还能超过100的? :melting_face:
显示器这里没做限制嘛?

1 个赞

显示器固件bug,我这个显示器超过43就爆表了。 :tieba_087:

3 个赞

:baguette_bread: 插个棍

1 个赞

插哪里……

2 个赞

:baguette_bread: 你说法棍插哪里?

2 个赞

插炼乳……

4 个赞

坏了!我的脑子开始自动渲染NSFW内容了 :sob:

2 个赞

炼乳多好吃啊,一股奶香味喵

3 个赞

你不要这样搞,再说就NSFW了 :face_with_peeking_eye: ,你看丛雨酱水个贴不容易。

2 个赞

(吃多了会长胖的

2 个赞

大黄油条,金黄的,就要沾豆浆

3 个赞

佬友可以看看这个项目呢

GitHub - xanderfrangos/twinkle-tray: Easily manage the brightness of your monitors in Windows from the system tray

用了很久了,体验还挺不错的

1 个赞

这个是Windows系统下的,Linux 的没得同类软件,没法子用。
不然我也不会专门去写脚本了。 :tieba_087:

3 个赞

有的有的,dms-shell(quickshell 有人在维护的配置,虽然但是,quickshell吞噬巨量ram【500M】



225哦~~,并且我这个似乎是有做整除的……

2 个赞

感谢分享!~

1 个赞

你好强!

1 个赞

Xorg用户泪目了。:sob:

quickshell支持x11
xorg用户不准:prohibited:落泪

1 个赞

我也用的这个,挺好用

1 个赞