2009/11/06

Switch between laptop LCD and external monitor in Ubuntu 9.10 (Karmic)

It is easy to switch display modes through system/preferences/display, but I wanted to make it even faster with keyboard shortcuts. It also gives you ability to force resolutions and relative display positions when using both displays at the same time.

Use XRANDR in the command prompt to find out names of connected displays.  In my case VGA1 = external monitor and LVDS1 = laptop LCD.

$ xrandr

Screen 0: minimum 320 x 200, current 1280 x 1024, maximum 8192 x 8192

VGA1 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 338mm x 270mm

   1280x1024      60.0*+   75.0 

   1152x864       75.0 

   1024x768       75.1     70.1     60.0 

   832x624        74.6 

   800x600        72.2     75.0     60.3     56.2 

   640x480        72.8     75.0     66.7     60.0 

   720x400        70.1 

LVDS1 connected (normal left inverted right x axis y axis)

   1280x800       60.0 +

   1024x768       85.0     75.0     70.1     60.0 

   832x624        74.6 

   800x600        85.1     72.2     75.0     60.3     56.2 

   640x480        85.0     72.8     75.0     59.9 

   720x400        85.0 

   640x400        85.1 

   640x350        85.1 

HDMI1 disconnected (normal left inverted right x axis y axis)

DP1 disconnected (normal left inverted right x axis y axis)

DP2 disconnected (normal left inverted right x axis y axis)

go to System/Preferences/Keyboard shortcuts and add

WIN+F5 use only laptop LCD

xrandr --output VGA1 --off --output LVDS1 --auto

WIN+F6 use only external monitor

xrandr --output LVDS1 --off --output VGA1 --auto

WIN+F7 use both (laptop on the left)

xrandr --output LVDS1 --auto --left-of VGA1 --auto

WIN+F8 use both (laptop above)

xrandr --output LVDS1 --auto --above VGA1 --auto

No comments:

Post a Comment