configfiles/scripts/monsetup.sh

55 lines
969 B
Bash
Executable file

#!/bin/bash
EXTERN="VGA1"
INTERN="LVDS1"
if [ $# -lt 1 ]; then
echo "monsetup <off|clone|second>"
exit 1
fi
bspwm_mv_win() {
for wid in $(bspc query -W -m $EXTERN); do
bspc window "$wid" -m $INTERN
done
}
bspwm_config_second() {
if [ "$1" != "1" ]; then
bspwm_mv_win
fi
}
xrandr_off() { xrandr --output VGA1 --off --output LVDS1 --primary --auto ; }
xrandr_clone() { xrandr --output VGA1 --auto --same-as LVDS1 --scale-from 1366x768 --output LVDS1 --primary --auto ; }
xrandr_second() { xrandr --output VGA1 --auto --right-of LVDS1 --output LVDS1 --primary --auto ; }
mode_off() {
bspwm_config_second 0
xrandr_off
}
mode_clone() {
bspwm_config_second 0
xrandr_off
xrandr_clone
}
mode_second() {
xrandr_off
xrandr_second
bspwm_config_second 1
}
case $1 in
off|clone|second)
mode_$1
;;
*)
echo No mode named $1
exit 1
;;
esac