configfiles/bspwm/.config/scripts/monsetup.sh
2015-10-08 10:31:53 +02:00

67 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
EXTERN="VGA1"
INTERN="LVDS1"
if [ $# -lt 1 ]; then
echo "monsetup <off|clone|second>"
exit 1
fi
bspwm_reset_desktops() {
bspc monitor $EXTERN -d 1 2 3 4 5 6 7 8 9
}
bspwm_mv_win() {
for wid in $(bspc query -W -m $EXTERN); do
bspc window "$wid" -m $INTERN
done
}
restore_wallpapers() {
nitrogen --restore
}
bspwm_config_second() {
if [ "$1" != "1" ]; then
bspwm_mv_win
else
bspwm_reset_desktops
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
restore_wallpapers
}
mode_clone() {
bspwm_config_second 0
xrandr_off
xrandr_clone
restore_wallpapers
}
mode_second() {
xrandr_off
xrandr_second
bspwm_config_second 1
restore_wallpapers
}
case $1 in
off|clone|second)
mode_$1
;;
*)
echo No mode named $1
exit 1
;;
esac