rice/proj

32 lines
715 B
Plaintext
Raw Normal View History

2019-07-04 20:31:12 +00:00
#!/bin/sh
set -x
2019-07-04 20:31:12 +00:00
# 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'`
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
2022-09-10 22:09:25 +00:00
xrandr --output $out --auto --$side DP-0
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
xrandr --output $out --off
2019-07-04 20:31:12 +00:00
exit 0
fi