Much ado about scripting, Linux & Eclipse: card subject to change

2010-01-05

Switching monitors with xrandr

Sure, there are applets and other GUI tools to do this, but nothing beats the purity of going commando, er, commandline. :) Thanks to this article for the inspiration.

# reset 
xrandr --auto

# turn off laptop screen
xrandr --output LVDS --off

# 24" 16x12 on
xrandr --output VGA --mode 1600x1200

# reset 
xrandr --auto

# turn off external screen
xrandr --output VGA --off

# laptop screen on
xrandr --output LVDS --mode 1280x800

UPDATE, 2010/01/05:

To enable both screens and force the larger one to include the taskbar:

# reset 
xrandr --auto

# laptop screen on
xrandr --output LVDS1 --mode 1280x800 --noprimary --pos 1600x0

# 24" 16x12 on
xrandr --output VGA1 --mode 1600x1200 --primary --pos 0x0

# echo current status
xrandr --current

1 comments:

Anonymous said...

Thank you. Figured out how to change the resolution. When I type xrandr two monitor outputs were displayed - LVDS1 and VGA1, and LVDS1 had a maximum resolution of 1024x768 while the native maximum resolution of my all in one computer is 1366x768. Used xrandr --output VGA1 --mode 1366x768 and now working fine. Cheers! I believe this may not stay like this upon reboot, if this happens for anyone simply put the relevant command into "Startup Applications" (Startup Applications is a built-in application with Ubuntu).

Regards.