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:
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: usr/local/ scripts/ external- monitor. sh"
# VGA changed
KERNEL=="card0", ACTION=="change", RUN+="/
/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