Add three `systemd` user units that reset volume, screen brightness, and keyboard backlight, so that every session starts from a known state. Values come from ~/.config/environment.d/50-defaults.conf, and can be overridden per machine via an untracked 90-local.conf
25 lines
459 B
Shell
Executable file
25 lines
459 B
Shell
Executable file
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
|
|
# Loaded from ~/.config/environment.d/50-defaults.conf or a local override
|
|
VOLUME="${DEFAULT_VOLUME:?unset, check ~/.config/environment.d/}"
|
|
|
|
|
|
i=0
|
|
while ! wpctl status >/dev/null 2>&1; do
|
|
i=$((i + 1))
|
|
if [ "$i" -ge 20 ]; then
|
|
echo "no PipeWire sink after 10s" >&2
|
|
exit 1
|
|
fi
|
|
sleep 0.5
|
|
done
|
|
|
|
|
|
wpctl set-volume @DEFAULT_AUDIO_SINK@ "$VOLUME%"
|
|
wpctl set-mute @DEFAULT_AUDIO_SINK@ 0
|
|
|
|
|
|
echo "Set volume to $VOLUME%"
|