Xrandr changes restart X session

Everything about X, Gnome, KDE, ... and everything running on it

Xrandr changes restart X session

Postby sergescr » 2015-09-22 07:31

Hello forum,

I am having a odd and rather annoying issue with xrandr on Debian 8 stable, which is due my lack of knowledge about udev and X, I am sure. I have a udev rule that changes xrandr setting when VGA is in/out (this is not my invention; credits: http://tutos.readthedocs.org/en/latest/source/Arch.html). I have the same setup on Arch, but I don't have this issue. So, well, the issue is that when I unplug the VGA cable sometimes xrandr will kill/crash X session or the window manager and drop me into the greeter (GDM). I have similar behavior sometimes when I run xrandr from terminal. What in this setup might be killing X session? I have Gnome3 installed, but I don't use it. I use i3 with all main configuration done by hand (power, binding, etc). Maybe it's i3wm that being terminated/crashed, not X? How can I be sure?

I clearly don't understand something in this setup, but I am not sure where to look. I reasonably comfortable with shell scripting, but I don't know how to write udev rules. I am not a novice, but definitely not an expert when it comes to troubleshooting issues like this and would really appreciate some help.

located in /etc/udev/rules.d/95-monitor-hotplug.rules
Code: Select all
#Rule for executing commands when an external screen is plugged in.
KERNEL=="card0", SUBSYSTEM=="drm", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/myname/.Xauthority", RUN+="/usr/local/bin/hotplug_monitor.sh"


Code: Select all
#! /bin/bash
# Sets right perspective when monitor is plugged in
# Needed by udev rule /etc/udev/rules.d/95-hotplug-monitor

export DISPLAY=:0
export XAUTHORITY=/home/myname/.Xauthority

function connect(){
    xrandr --output VGA1 --right-of LVDS1 --preferred --primary;
    xrandr --output LVDS1 --off
}

function disconnect(){
      xrandr --output VGA1 --off;
}

xrandr | grep "VGA1 connected" &> /dev/null && connect || disconnect
sergescr
 
Posts: 11
Joined: 2014-12-08 14:02

Return to Desktop & Multimedia

Who is online

Users browsing this forum: No registered users and 8 guests

fashionable