2019-02-05 19:30:40 -08:00
|
|
|
#!/bin/bash
|
2019-06-20 20:38:14 -07:00
|
|
|
if [ "$1" == "-h" ] ; then
|
|
|
|
|
echo "
|
|
|
|
|
hdmi - setup external display if connected, else ensure the display is off
|
|
|
|
|
- run 'xrandr' to see display interface names for input
|
2020-05-10 22:25:36 -07:00
|
|
|
- use for X11 window managers such as i3wm
|
2019-06-20 20:38:14 -07:00
|
|
|
|
|
|
|
|
Usage: hdmi.sh
|
|
|
|
|
hdmi.sh DP1
|
|
|
|
|
"
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
2019-02-05 19:30:40 -08:00
|
|
|
intern=eDP1
|
2019-06-20 20:38:14 -07:00
|
|
|
extern=${1:-HDMI1}
|
2019-02-05 19:30:40 -08:00
|
|
|
|
|
|
|
|
if xrandr | grep "$extern connected"; then
|
|
|
|
|
xrandr --output "$intern" --auto --output "$extern" --auto --right-of "$intern"
|
|
|
|
|
else
|
|
|
|
|
xrandr --output "$intern" --auto --output "$extern" --off
|
|
|
|
|
fi
|