Modify xrandr and audio script to be dock-aware

This commit is contained in:
Felix Van der Jeugt 2019-11-21 15:11:38 +01:00
parent a9b5295293
commit 259680d31a
No known key found for this signature in database
GPG key ID: 58B209295023754D
2 changed files with 22 additions and 18 deletions

View file

@ -1,7 +1,10 @@
#!/bin/sh
uplimit="$(amixer get Master | grep "Limits:" | tr -s ' ' | cut -d' ' -f6)"
lolimit="$(amixer get Master | grep "Limits:" | tr -s ' ' | cut -d' ' -f4)"
current="$(amixer get Master | grep "Mono:" | tr -s ' ' | cut -d' ' -f4)"
card="$(aplay -l | sed -n 's/^card [0-9]*: \(\w*\).*/\1/p' | tail -1)"
control="$(amixer -c "$card" scontrols | sed -n "1s/.*'\(.*\)'.*/\1/p")"
uplimit="$(amixer -c "$card" get "$control" | grep "Limits:" | tr -s ' ' | cut -d' ' -f6)"
lolimit="$(amixer -c "$card" get "$control" | grep "Limits:" | tr -s ' ' | cut -d' ' -f4)"
current="$(amixer -c "$card" get "$control" | sed -n '/dB/{p;q}' | sed 's/.*Playback \([0-9]*\) .*/\1/')"
wjt -l "$lolimit" -u "$uplimit" -x "$current" | while read next; do
amixer -q set Master "$next"
amixer -c "$card" -q set "$control" "$next"
done