add brightness control for I2C monitors

This commit is contained in:
Martin Sekera 2025-01-18 00:51:30 +01:00
parent f351889c30
commit 38ee4f1809
2 changed files with 17 additions and 0 deletions

11
bin/brightness-i2c Executable file
View file

@ -0,0 +1,11 @@
#! /bin/zsh
OPERATOR="${1}"
AMOUNT="${2}"
BUSES=(${(s/:/)OVER_ENV_MONITORS_I2C})
for BUS in ${BUSES}
do
ddcutil --skip-ddc-checks --noverify --verbose --bus=${BUS} setvcp 0x10 "${OPERATOR}" "${AMOUNT}"
done

View file

@ -5,6 +5,12 @@ zmodload zsh/datetime
OVER_PROMPT_CFG="/etc/over/env/prompt.cfg"
OVER_PROMPT_TITLE=""
which ddcutil > /dev/null
if [[ $? -eq 0 ]]; then
local I2C_IDS=($(ddcutil detect --terse | grep "I2C bus" | sed "s/^.*-//"))
export OVER_ENV_MONITORS_I2C=${(j|:|)I2C_IDS}
fi
if [[ -a "$OVER_PROMPT_CFG" ]]; then
source "$OVER_PROMPT_CFG"
fi