Hi Alex,

the problem is, also root hasn't the rights to use a x-server owned by
an other user. You can force root to use an other users xauthority by
setting the environment variable to the users xauthority data:

export XAUTHORITY=/home/.../.Xauthority

Here is my hack to use the external monitor if the VGA is plugged in:

/etc/udev/rules.d/70-external-monitor.rules:
# VGA changed
KERNEL=="card0", ACTION=="change", RUN+="/usr/local/scripts/external-monitor.sh"

/usr/local/scripts/external-monitor.sh:
#!/bin/sh

status="$(cat /sys/class/drm/card0-VGA-1/status)"

export XAUTHORITY=/home/marius/.Xauthority 
export DISPLAY=:0.0

if [ "${status}" = disconnected ] 
then
        xrandr --output LVDS1 --auto --output VGA1 --off
elif [ "${status}" = connected ] 
then
        xrandr --output LVDS1 --off --output VGA1 --auto
fi

-- 
udev scripts running as root cannot use xrandr
https://bugs.launchpad.net/bugs/660901
You received this bug notification because you are a member of Ubuntu-X,
which is subscribed to xserver-xorg-video-intel in ubuntu.

_______________________________________________
Mailing list: https://launchpad.net/~ubuntu-x-swat
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~ubuntu-x-swat
More help   : https://help.launchpad.net/ListHelp

Reply via email to