Modify xrandr and audio script to be dock-aware
This commit is contained in:
parent
a9b5295293
commit
259680d31a
@ -1,17 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
contains() {
|
||||
what="$1"
|
||||
shift
|
||||
while [ -n "$1" ]; do
|
||||
[ "$what" = "$1" ] && return 0
|
||||
shift
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
where="${1:-above}"
|
||||
contains "$where" "above" "below" "left-of" "right-of" || exit 1
|
||||
|
||||
xset dpms 0 0 0
|
||||
xrandr --output DP1 --auto --$where eDP1
|
||||
|
||||
dp1="$(xrandr --listactivemonitors | grep ' DP1$')"
|
||||
dp1_1="$(xrandr --listactivemonitors | grep ' DP1-1$')"
|
||||
dp1_2="$(xrandr --listactivemonitors | grep ' DP1-2$')"
|
||||
|
||||
if [ -n "$dp1" -a -z "$dp1_1" -a -z "$dp1_2" ]; then
|
||||
xrandr --output DP1 --auto --above eDP1
|
||||
elif [ -z "$dp1" -a -n "$dp1_1" -a -z "$dp1_2" ]; then
|
||||
xrandr --output DP1-1 --auto --above eDP1
|
||||
elif [ -z "$dp1" -a -n "$dp1_1" -a -n "$dp1_2" ]; then
|
||||
xrandr --output DP1-1 --auto --left-of eDP1 \
|
||||
--output DP1-2 --auto --right-of eDP1
|
||||
fi
|
||||
|
||||
~/.fehbg
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user