2019-07-04 20:31:12 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Add or remove projectors
|
|
|
|
c=`printf 'Add\nRemove' | dmenu -i -p 'Add/Remove screens'`
|
|
|
|
|
|
|
|
if [ "$c" = "Add" ]
|
|
|
|
then
|
|
|
|
# Grab the display device
|
|
|
|
out=`xrandr | grep ' connected' | awk '{print $1}' | \
|
|
|
|
dmenu -i -p 'Device to attach'`
|
2019-12-03 00:58:00 +00:00
|
|
|
echo $out
|
2019-07-04 20:31:12 +00:00
|
|
|
if [ -z "$out" ]; then exit 0; fi
|
|
|
|
|
|
|
|
# what side should it go on
|
|
|
|
side=`printf 'left-of\nright-of\nabove\nbelow' | \
|
|
|
|
dmenu -i -p 'Pick side'`
|
|
|
|
if [ -z "$side" ]; then exit 0; fi
|
|
|
|
|
2019-07-05 04:13:58 +00:00
|
|
|
echo "xrandr --output $out --auto $side eDP-1"
|
2019-12-03 00:58:00 +00:00
|
|
|
xrandr --output $out --auto --$side eDP1 #DVI-I-1
|
2019-07-04 20:31:12 +00:00
|
|
|
else
|
2019-07-05 04:13:58 +00:00
|
|
|
# Get the display we want to remove
|
2019-07-04 20:31:12 +00:00
|
|
|
out=`xrandr | grep ' connected' | awk '{print $1}' | \
|
|
|
|
dmenu -i -p 'Device to dettach'`
|
|
|
|
if [ -z "$out" ]; then exit 0; fi
|
2019-07-05 04:13:58 +00:00
|
|
|
|
|
|
|
# Remove that device from xrandr
|
|
|
|
echo "xrandr --output $out --off"
|
|
|
|
xrandr --output $out --off
|
2019-07-04 20:31:12 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|