dot_testing/scripts/disp

35 lines
845 B
Plaintext
Raw Normal View History

2021-02-15 12:02:09 -06:00
#!/bin/sh
exists() {
xrandr | grep ' connected' | grep "${1}" | wc -l
}
# usual setup: thinkpad x220 on dock connected to external
# monitor
2021-04-26 10:58:26 -05:00
[ $(exists "HDMI2") -eq 1 ] && \
[ $(exists "LVDS1") -eq 1 ] && \
2021-02-15 12:02:09 -06:00
xrandr --output LVDS1 --below HDMI2 --auto && \
2021-04-26 10:58:26 -05:00
bspc monitor LVDS1 I II III IV V && \
bspc monitor HDMI2 VI VII VIII IX X && \
2021-02-15 12:02:09 -06:00
exit 0 || exit 1
# thinkpad x220 connected to display on local port
2021-04-26 10:58:26 -05:00
[ $(exists "HDMI1") -eq 1 ] && \
[ $(exists "LVDS1") -eq 1 ] && \
2021-02-15 12:02:09 -06:00
xrandr --output LVDS1 --below HDMI1 --auto && \
2021-04-26 10:58:26 -05:00
bspc monitor LVDS1 I II III IV V && \
bspc monitor HDMI1 VI VII VIII IX X && \
2021-02-15 12:02:09 -06:00
exit 0 || exit 1
# only the thinkpad
[ $(exists "HDMI2") -eq 0 ] && \
2021-04-26 10:58:26 -05:00
[ $(exists "LVDS1") -eq 1 ] && \
2021-02-15 17:16:23 -06:00
xrandr --output HDMI2 --off && \
2021-04-26 10:58:26 -05:00
bspc monitor -d I II III IV V VI VII VIII IX X && \
2021-02-15 12:02:09 -06:00
exit 0 || exit 1
exit 1