Comment 3 for bug 660901

Revision history for this message
Marius (mariusknaust) wrote :

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:

# VGA changed
KERNEL=="card0", ACTION=="change", RUN+="/usr/local/scripts/"


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

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

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