luwill
2020-11-18 13:54:07 +08:00
displayplacer + 自动操作 + 快捷键
附上我的代码:
$ cat ~/bin/display_reset
/usr/local/homebrew/bin/displayplacer "id:99F4A8E9-A785-98B5-299F-7D25FBBAEE76 res:1920x1080 hz:60 color_depth:8 scaling:on origin:(0,0) degree:0" "id:A44688BB-547B-2FAE-E05E-0D87122C1045 res:1080x1920 hz:60 color_depth:8 scaling:on origin:(-1080,-191) degree:90"
亮度解决方案:
$ cat ~/bin/brighter
#!/bin/bash
STEP=3
B=$(ddcctl -d 1 -b \? |grep -Eo "current: \d+" |grep -Eo "\d+")
C=$[${B} + 5]
KEY=()
echo -e "调整显示器亮度,当前亮度: ${B},对比度: ${C}。UP 变亮,DOWN 变暗"
while :
do
read -s -n 1 KEY
case ${KEY[0]} in
"A")
B=$[${B} + ${STEP}]
C=$[${B} + 5]
;;
"B")
B=$[${B} - ${STEP}]
C=$[${B} - 5]
;;
"C")
echo "reset"
B=50
C=55
;;
*)
continue
;;
esac
ddcctl -d 1 -b ${B} -c ${C} >/dev/null
ddcctl -d 2 -b ${B} -c ${C} >/dev/null
echo -e "调整显示器亮度,当前亮度: ${B},对比度: ${C}。UP 变亮,DOWN 变暗"
done
echo "重置浏览器方向"
bash /Users/luwei.will/bin/display_reset