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