#!/bin/bash
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=935896
# Fixed. Work on Fluxbox / xfce4... Smaller / faster, use far less system/disk/cpu/memory
# than the gnome / spice implementation (which at the final, use xrandr too)
# This is another example on how dumb the ongoing development 
# lead by RedHat / Canonical is made
  while :
  do
  current_size=`xrandr | sed 's/[Virtual|Screen].*//' | tr -d '\n' | awk '{print $1}'`
  output=`xrandr --listactivemonitors | awk '{print $4}' |  tr -d '\n'`
  saved_size=`cat /tmp/size`
    if [ "$current_size" = "$saved_size" ]; then
      sleep 1;
    else
      echo $current_size > /tmp/size
      xrandr --output $output --auto
      sleep 1;
    fi
  done
