brightness-i2c: fix log spam on denied access, move monitor detection from prompt to zshrc

This commit is contained in:
roku 2025-02-01 11:03:08 +01:00
parent 89bc29d5b0
commit b6d069b90a
2 changed files with 12 additions and 7 deletions

View file

@ -218,3 +218,15 @@ do
break break
fi fi
done done
# detect monitors for bin/brightness-i2c
which ddcutil > /dev/null
if (( $? == 0 )); then
local I2C_IDS=($(ddcutil detect --terse 2>/dev/null | grep "I2C bus" | sed "s/^.*-//"))
# will be empty if no monitors support ddc or if we don't have I2C access via ACL
if (( ${#I2C_IDS[@]} > 0)); then
mkdir -p $XDG_RUNTIME_DIR/over
echo ${(j|:|)I2C_IDS} >! $XDG_RUNTIME_DIR/over/monitors-i2c
fi
fi

View file

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