Run script after X starts -- correct file location?

I wanted to run a script when X starts that will set-up a dual head arrangement. I’m unsure where to place it exactly. In /etc/rc.d? Somewhere in /etc/X11/?

This script is taken from Xorg RandR 1.2 - ThinkWiki, but I believe the location they provide is ubuntu-specific (/etc/X11/Xsession.d/45custom_xrandr-settings) – or at least, creating that folder and file does nothing when I start x.

Thanks!

# If an external monitor is connected, place it with xrandr
 
# External output may be "VGA" or "VGA-0" or "DVI-0" or "TMDS-1"
EXTERNAL_OUTPUT="VGA"
INTERNAL_OUTPUT="LVDS"
# EXTERNAL_LOCATION may be one of: left, right, above, or below
EXTERNAL_LOCATION="right"
 
case "$EXTERNAL_LOCATION" in
       left|LEFT)
               EXTERNAL_LOCATION="--left-of $INTERNAL_OUTPUT"
               ;;
       right|RIGHT)
               EXTERNAL_LOCATION="--right-of $INTERNAL_OUTPUT"
               ;;
       top|TOP|above|ABOVE)
               EXTERNAL_LOCATION="--above $INTERNAL_OUTPUT"
               ;;
       bottom|BOTTOM|below|BELOW)
               EXTERNAL_LOCATION="--below $INTERNAL_OUTPUT"
               ;;
       *)
               EXTERNAL_LOCATION="--left-of $INTERNAL_OUTPUT"
               ;;
esac
 
xrandr |grep $EXTERNAL_OUTPUT | grep " connected "
if  $? -eq 0 ]; then
    xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --auto $EXTERNAL_LOCATION
else
    xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --off
fi
 
  • roidemai,

not exactly an answer to your question, but does this article help?
http://en.opensuse.org/Multiple_Displays_Using_XRandR

Uwe

Unfortunately not.
(another note about that guide: I spent weeks trying to get it to work, until I noticed some hints ubuntu RandR wiki … it seems sax2 kept including things in xorg.conf that prevented xrandr from functioning)

At any rate, I saw a few candidates locations, but I’m not sure which makes the most sense:

/etc/X11/xinit/xinitrc
$HOME/,xinitrc.template
create the non-existant $HOME/.xsession ?
$HOME/.profile
$HOME/.bashrc

On 04/16/2009 roidemai wrote:
> /etc/X11/xinit/xinitrc

This one if you want it for all users.

> $HOME/,xinitrc.template

This one, remove the “.template”

> -create the
> non-existant- $HOME/.xsession ?

We don’t use this on openSUSE, xinitrc instead.

> $HOME/.profile $HOME/.bashrc

Not X related, no idea if it works, since I am not sure about the order these scripts run in.

Uwe

PS:
Sorry for the delay, I was out for a long weekend :slight_smile: