3 # am7xxx-autodisplay - resize the screen and run am7xxx-play
 
   5 # Copyright (C) 2012-2014  Antonio Ospite <ao2@ao2.it>
 
   7 # This program is free software. It comes without any warranty, to
 
   8 # the extent permitted by applicable law. You can redistribute it
 
   9 # and/or modify it under the terms of the Do What The Fuck You Want
 
  10 # To Public License, Version 2, as published by Sam Hocevar. See
 
  11 # http://sam.zoy.org/wtfpl/COPYING for more details.
 
  13 # This is just an example script to show how to resize the screen before
 
  14 # running am7xxx-play, this can be called also from a udev script.
 
  16 # Resizing the screen may be needed if the am7xxx device has problems
 
  17 # displaying a certain resolution.
 
  19 # For example on some devices the firmware fails to display images of
 
  20 # resolution 800x469 resulting from scaled down 1024x600 screens, in
 
  21 # cases like this, resizing the screen can be a viable workaround.
 
  25 RESOLUTION_PROJECTOR=800x600
 
  26 RESOLUTION_ORIGINAL=1024x600
 
  28 AM7XXX_PLAY=am7xxx-play
 
  30 # needed when running xrandr as root from udev rules,
 
  31 # see https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/660901
 
  32 export XAUTHORITY=$(find /var/run/gdm3/ -type f -path "*${USER}*" 2> /dev/null)
 
  38     xrandr --size $RESOLUTION_PROJECTOR && \
 
  39       $AM7XXX_PLAY -f x11grab -i $DISPLAY
 
  43     xrandr --size $RESOLUTION_ORIGINAL
 
  47     { echo "usage: $(basename $0) <start|stop>" 1>&2; exit 1; }