F8x86_64 on the Acer Ferrari 3400LMi
function usage() {
printf "Usage: %s [init|toggle|status|internal|tv [side]]\n" \
"`basename $0`"
}
ME=`basename $0 .sh`
# What to do?
ACTION="${1:$DEFAULTACTION}"
# Which side of $INTERNAL should the external output be shown?
SIDE="${2:$DEFAULTSIDE}"
# If invalid action or help, quit before calling xrandr
case `echo "$ACTION" | tr AZ az` in
init | toggle | status | internal | tv )
# Recognized actions. Do nothing and continue...
;;
help | usage )
usage
exit 0
;;
* )
printf "%s: Unknown operation, %s\n" "$ME" "$ACTION"
usage
exit 1
;;
esac
# Get information about all outputs
ALLINFO=( $( \
xrandr q \
| awk '/connected/ {
printf " %s", $1;
if ($2 !~ /dis/) {
if ($3 ~ /[09]+x/)
printf "@%s", $3;
else
printf "@";
}
}' \
) )
# Initialize some useful variables
for (( i=0; i<${#ALLINFO[*]}; i++ )) {
# Array with all outputs
ALLOUT[$i]=$( \
echo "${ALLINFO[$i]}" \
| awk F@ '{print $1}' \
)
# Array with all connected outputs
CONCTD[$i]=$( \
47