dotfiles/.bin/OLD/dock

27 lines
696 B
Plaintext
Raw Normal View History

#!/bin/sh
INTERNAL=LVDS-1
CONLIST=$(xrandr --query | grep " connected" | awk '{ print $1 }' | grep -v $INTERNAL)
OFFLIST=$(xrandr --query | grep "disconnected" | awk '{ print $1 }')
if [ -z "$CONLIST" ]; then
printf 'No external displays found, activating %s\n' "$INTERNAL"
xrandr --output $INTERNAL --auto
else
printf 'External displays found, deactivating %s\n' "$INTERNAL"
xrandr --output $INTERNAL --off --noprimary
fi
for _dev in $OFFLIST;
do
printf 'Turning off disconnected output: %s\n' "$_dev"
xrandr --output $_dev --off
done
for _dev in $CONLIST;
do
printf 'Turning on connected output: %s\n' "$_dev"
xrandr --output $_dev --auto --primary
done