# Switch X between internal and external panels



## loop (Aug 18, 2010)

Has anyone got a script that they use for switching the X display between the internal panel and an external monitor?

Thinkpads have a dedicated key (usually Fn+F7) for this purpose, and while I know the ACPI code, I'm not sure how to actually perform the switch.


----------



## phoenix (Aug 19, 2010)

I do this on an older Toshiba laptop (2.8 GHz P4 Celeron, Ati RADEON 7000) using xrandr.

The general process is:

switch LCD to the desired resolution
activate the external display at the same resolution, as a mirror of the LCD
disable the LCD

Here's what I'm using, to enable the S-Video out port at 800x600:

```
#!/bin/sh

# Swtich resolution on the internal LCD
xrandr --output LVDS --mode 800x600

# Configure the S-Video out
xrandr --addmode S-video 800x600
xrandr --output S-video --mode 800x600

# Disable the internal LCD
xrandr --output LVDS --off

# Switch the primary display for XV to S-Video out (needed for VLC)
xvattr --attribute XV_CRTC --value 1


# Enable lcd
#xrandr --output S-video --off
#xrandr --output LVDS --mode 1024x768
#xrandr --output LVDS --auto
```

It's currently only 1-way, as this is my HTPC, but the commented out parts show how to reverse it.


----------

