Dual monitors with Openbox and Xrandr


Some of the popular desktop environments make it really easy to use two monitors. Some even automatically detect and arrange them for you. However, Openbox doesn't do this (it's a window manager, anyway, not a DE) out of the box. And I don't like to install heavy apps to arrange my displays when I can do it quickly with Xrandr from a terminal emulator.

First, type xrandr in a terminal. This will display the detected monitors and their resolution.

Now, you can enter a command to adjust the resolution and layout of your displays: xrandr --auto --output VGA-1 --mode 1440x900 --right-of LVDS-1

That command is for the external monitor I usually have to the right of my laptop. VGA-1 is the external monitor and LVDS-1 is my laptop's built in monitor. This command tells xrandr to arrange the external monitor to the right and set the resolution to 1440x900.

I then use this command: xrandr --auto --output LVDS-1 --mode 1280x800 --left-of VGA-1 to set the resolution of my internal display. I usually add these two commands to openbox's autostart script (/etc/xdg/openbox/autostart) so that Xrandr sets my displays properly when openbox starts up.