Linux and Dual Screens

dualScreenOne thing that I love about working at Zoom is that they give us the freedom to use the tools that we require to get the job done. For me, that is Sidux, Kate (the all powerful and awesome KDE text editor/IDE), SSH and the command line. Sure I use other tools (Virtual Box for Adobe CS3, Filezilla FTP client, GiMP, etc…) but one of the things that I really love about my computer is how easy it is to set up my dual screen set up. I don’t use any of the native built in tools to set this up, as I have found them sometimes amazing and sometimes terribly lacking. I pull up a BASH prompt, fire off a command, and get to work. Today I want to talk about the amazing command xrandr.

If you want to get your dual screens set up without much fuss, fire up your BASH prompt and click to read some more!

XRandR stands for X Resize and Rotate Extension, where X is talking about the X server that makes all the desktop stuff possible. To see if this command is possible for you to use, just type in xrandr into your bash prompt and it should spit out a list of your available video devices, and their display sizes. Depending on your video card and ports, you can do some really cool things with this information. I have a Lenovo IdeaPad Y650 which comes with a built in Intel video card with 256 shared video RAM. Not the most powerful of cards, but way good enough for what I have to do. When I run the command xrandr i get this output:

Screen 0: minimum 320 x 200, current 2806 x 900, maximum 4096 x 4096
VGA connected 1440x900+1366+0 (normal left inverted right x axis y axis) 408mm x 255mm
   1440x900       59.9*+   75.0     59.9*
   1600x1024      60.2
   1400x1050      60.0
   1280x1024      75.0     60.0
   1280x960       60.0
   1360x768       59.8
   1152x864       75.0     75.0     70.0     60.0
   1024x768       75.0     70.1     60.0
   832x624        74.6
   800x600        72.2     75.0     60.3     56.2
   640x480        75.0     72.8     75.0     66.7     59.9
   720x400        70.1
LVDS connected 1366x768+0+0 (normal left inverted right x axis y axis) 353mm x 198mm
   1366x768       60.0*+
   1360x768       59.8
   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
HDMI-1 disconnected (normal left inverted right x axis y axis)

You can see that I have three available video ports (VGA, LVDS and HDMI) and two of those are used. If I didn’t have a monitor plugged into the VGA port on the side of my laptop, then all those modes listed under the VGA port would be missing, and it also wouldn’t tell me that it’s connected.

So, what do we do with all this output? Lets build a nice long bash command to tell X how to use our devices. It’s really easy and VERY expandable. We basically tell X what screen resolution we want each device to be, and where these screens are in relation to each other. Here’s how mine looks when I’m at work and want both screens hooked up, the laptop screen to the left and the monitor to the right:

xrandr --output LVDS --mode 1366x768 --output VGA --mode 1440x900 --right-of LVDS

When I leave the office and want to go back to just the laptop screen I use this:

xrandr --output LVDS --mode 1366x768 --output VGA --off

Easy as pie! (being somewhat of a nerd, I don’t actually know how easy pie is…)

Note the first command where I use the option –right-of. If I wanted the monitor to be the left screen on my desk, I would just change this command to say –left-of. I could also use –above, –below or –same-as to get it to be in different locations, or duplicate the output of my laptop screen.

Alright, so all you users out there that can’t seem to get your dual screen setup working, give this a try and let me know in the comments if you need any help! I recommend setting these to aliases in your .bashrc file, or scripting them to do things automatically-udev event maybe? That will have to wait for another day with another blog post…

Tags: , ,

2 Responses to “Linux and Dual Screens”

 
  1. mewebhost says:

    Right on. Personally, I don’t know why more people don’t choose a dual montior setup. It’s incredibly easy — and it’s probably one of the best things you can do to increase your productivity.

  2. Justin says:

    w00t! Thanks, Kurtis. Almost 3 years after this post was written by you, I get to finally put this info to good use. I am dual monitoring.

 

Leave a Reply