[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#455225: /usr/bin/xrandr: please consider possibility to disable hardware detection



On Tue, Dec 11, 2007 at 08:44:04AM +0100, Marc Haber wrote:
> How would that call look like?
> 
> xrandr --output VGA-0 --auto --left-of LVDS --output LVDS --auto?

It looks like an output can only be mentioned once, so

xrandr --output VGA-0 --auto --output LVDS --auto --output VGA-0 --left-of LVDS

won't work. So, a little more command line processing is necessary.

For the record, here my current script:

$ cat .my/bin/xrandrauto
#!/bin/bash

if ! TMPFILE=$(tempfile --prefix xrandr); then
  echo >2 "ERR: cannot create tempfile"
  exit 1
fi

xrandr > $TMPFILE

CONOUTPUTLIST=""
OUTPUTLIST=""
OPTIONS=""
for output in $(< $TMPFILE sed -n '/[^[:space:]]\+ connected/{s/\([^[:space:]]\+\).*/\1/;p;}'); do
  CONOUTPUTLIST="$CONOUTPUTLIST $output"
  OUTPUTLIST="$OUTPUTLIST $output"
  OPTIONS="$OPTIONS --output $output --auto"
done
for output in $(xrandr | sed -n '/[^[:space:]]\+ disconnected/{s/\([^[:space:]]\+\).*/\1/;p;}'); do
  OUTPUTLIST="$OUTPUTLIST $output"
  OPTIONS="$OPTIONS --output $output --auto"
done

if [ "$CONOUTPUTLIST" = " VGA-0 LVDS" ]; then
  OPTIONS="$(echo $OPTIONS | sed "s/\(--output VGA-0\)/\1 --left-of LVDS/")"
elif [ "$OUTPUTLIST" = " LVDS" ]; then
  OPTIONS="$(echo $OPTIONS | sed "s/\(--output LVDS\)/\1 --pos 0x0/")"
fi
xrandr $OPTIONS

rm -f $TMPFILE
[5/504]mh@scyw00225:~$

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 72739835




Reply to: