date "+%A, %B %d, %r, %S seconds"
-##### begin command line parsing ########
dry_run=false
downres=true
quarter=true
tall=false
restart=false
-temp=$(getopt -l help fnrs: "$@") || usage 1
-eval set -- "$temp"
-while true; do
- case $1 in
- -f)
- downres=false
- quarter=false
- tall=false
- ;;
- -n) dry_run=true ;;
- -s)
- case $2 in
- tall)
- tall=true
- quarter=false
- ;;
- quarter)
- tall=false
- quarter=true
- ;;
- full)
- tall=false
- quarter=false
- ;;
- esac
- shift
- ;;
- -r) restart=true ;;
- -h|--help) usage 0 ;;
- --) shift; break ;;
- *) echo "$0: Internal error! unexpected args: $*" ; exit 1 ;;
- esac
- shift
-done
-
-##### end command line parsing ########
xf=$(mktemp)
m() { printf "$script_name: %s\n" "$*"; }
fi
-for mon_suffix in TOP-LEFT BOTTOM-LEFT LEFT RIGHT; do
- if xrandr --listmonitors | awk '$2 == "MON-'$mon_suffix\" |grep . >/dev/null; then
- m xrandr --delmonitor MON-$mon_suffix
- fi
-done
secondary_out=$(awk '$2 == "connected" && $3 != "primary" {print $1}' $xf)
if [[ $secondary_out ]]; then
- # some monitors need off then on to become active
- if $restart; then
- m xrandr --output $secondary_out --off
- m sleep 2
- fi
-
x_offset=$primary_x
left_right_arg=--right-of
if [[ $secondary_out == HDMI2 && $(edid card0-HDMI-A-2) == 192efbdcef ]] || \
target_x=${target_res%x*}
target_y=${target_res#*x}
else
- # disables any leftover secondary.
- xrandr --auto
target_out=$primary_out
x_offset=0
target_res=$primary_res
target_y=$primary_y
fi
+
if (( target_x <= 1280 )); then
quarter=false
tall=false
+elif (( target_x <= 1920 )); then
+ quarter=false
+ tall=true
fi
if $downres && (( target_x > 2560 )); then
target_x=2560
target_y=1440
target_res=${target_x}x$target_y
- if [[ $secondary_out || $primary_res != "$target_res" ]]; then
- m xrandr --output $target_out $left_right_arg --mode $target_res
+fi
+
+
+half_x=$(( target_x / 2 ))
+half_y=$(( target_y / 2 ))
+
+
+
+##### begin command line parsing ########
+
+temp=$(getopt -l help fnrs: "$@") || usage 1
+eval set -- "$temp"
+while true; do
+ case $1 in
+ -f)
+ downres=false
+ quarter=false
+ tall=false
+ ;;
+ -n) dry_run=true ;;
+ -s)
+ case $2 in
+ tall)
+ tall=true
+ quarter=false
+ ;;
+ quarter)
+ tall=false
+ quarter=true
+ ;;
+ full)
+ tall=false
+ quarter=false
+ ;;
+ esac
+ shift
+ ;;
+ -r) restart=true ;;
+ -h|--help) usage 0 ;;
+ --) shift; break ;;
+ *) echo "$0: Internal error! unexpected args: $*" ; exit 1 ;;
+ esac
+ shift
+done
+
+##### end command line parsing ########
+
+for mon_suffix in TOP-LEFT BOTTOM-LEFT LEFT RIGHT; do
+ if xrandr --listmonitors | awk '$2 == "MON-'$mon_suffix\" |grep . >/dev/null; then
+ m xrandr --delmonitor MON-$mon_suffix
+ fi
+done
+
+
+if [[ $secondary_out ]]; then
+ if $restart; then
+ m xrandr --output $secondary_out --off
+ m sleep 2
fi
else
+ # disables any leftover secondary.
+ xrandr --auto
+fi
+
+if [[ $secondary_out || $primary_res != "$target_res" ]]; then
m xrandr --output $target_out $left_right_arg --mode $target_res
fi
-half_x=$(( target_x / 2 ))
-half_y=$(( target_y / 2 ))
+m /a/bin/ds/i3-sway/gen
if $tall; then
move-ws $target_out 2 3 5 6 7 8 9 10
fi
-m /a/bin/ds/i3-sway/gen
m /a/exe/input-setup
echo -n "myx end: "