Dual Head on Ubuntu Hardy with Intel GM965 (Part 2)

Now that I had dual head working on Ubuntu Hardy 8.04 with my D830, I wanted to be able to undock and automatically get my workspace only on the internal laptop screen. When I put my laptop in the docking station I want it to extend over both the external monitor and the internal laptop screen. And when I boot in the docking station I want my workspace automatically on both screens.
So far I was only partially successful.

Adjust Screen at Login

The first thing I did was adding a script that gets run when I logon. I found it here:

To configure xrandr automatically during the first login, save this script to your computer as /etc/X11/Xsession.d/45custom_xrandr-settings:

# 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_LOCATION may be one of: left, right, above, or below

               EXTERNAL_LOCATION="--left-of $INTERNAL_OUTPUT"
               EXTERNAL_LOCATION="--right-of $INTERNAL_OUTPUT"
               EXTERNAL_LOCATION="--left-of $INTERNAL_OUTPUT"

xrandr |grep $EXTERNAL_OUTPUT | grep " connected "
if [ $? -eq 0 ]; then
    xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --auto $EXTERNAL_LOCATION
    xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --off

When X starts, it will be mirrored across both screens until someone logs in. At that point this script will execute and xrandr will position the external monitor.

This works great!

Adjusting Screen when (Un-)Docking

For docking/undocking I found a description how this can be done on a IBM Thinkpad. It was easy enough to adapt to my situation:

  1. Edit /etc/modprobe.d/options (I’m not sure if this is really needed):

    options dock immediate_undock=0

  2. Create /usr/local/sbin/dock with permissions 755:

    /usr/bin/xrandr --output LVDS --auto --output TMDS-1 --auto --left-of LVDS
    # Anything else that you want executed on docking goes here.

  3. Create /usr/local/sbin/undock with permissions 755:

    /usr/bin/xrandr --output LVDS --auto --output TMDS-1 --off
    # Anything else that you want executed on ejection goes here.

    echo 1 > /sys/devices/platform/dock.0/undock

  4. Create /etc/udev/rules.d/50-dock.rules:

    ENV{EVENT}=="undock", KERNEL=="dock.0", SUBSYSTEM=="platform", RUN+="/usr/local/sbin/undock"
    ENV{EVENT}=="dock", KERNEL=="dock.0", SUBSYSTEM=="platform", RUN+="/usr/local/sbin/dock"

  5. Restart udev:

    $ sudo /etc/init.d/udev restart

The scripts get called when I dock or undock, but the screens don’t get changed somehow. I don’t know why (if you know, please let me know). However, when I undock I can press Fn-F8 which then puts everything on my laptop screen.


2 thoughts on “Dual Head on Ubuntu Hardy with Intel GM965 (Part 2)

  1. Virtual Memory: PLEASE HELP!
    After searching for hours, I was extremely pleased to find a helpful instruction for getting dual head on my laptop (Lenovo 3000 N200, OS=Hardy) with Intel’s notorious GM965 on-board card.
    The only tweak I needed was to add (as described by be in part I, thank you eb!):
    | SubSection “Display”
    | Virtual 2048 2048
    | EndSubSection
    into xorg.config, and hey presto, after a reboot i could configure the external monitor *above* the internal one, using Gnome’s Screen&Graphics tool. (1280×800 and ext. 1280×1024).
    This however is still a compromise as I cannot place the two screens *besides* each other, they’re arranged vertically. Obviously, the virtual memory has to be set higher. In my case, 2560×2560 would be ok.
    I could not patch i956_render.c nor the mesa file, as described by eb. I’m *not* an experienced user of bash, obviously I’m missing something out.
    Could PLEASE any reader give me the detailed steps for performing the patches?
    Thank you very much,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s