Xmonad – Fix Same Application Appearing on Both Monitors

xmonad

I started using xmonad on an Ubuntu box with two monitors attached. When I start xmonad the same layout is duplicated on both monitors. For example: if I have a layout where Chrome and emacs are tiled side-by-side, then I see chrome on the left side of both monitors, and emacs on the right side of both monitors.

Is there a way to say "chrome, go to the left monitor, emacs, go to the right monitor"?

Best Answer

To me it sounds like the view is cloned. There are two steps to fixing your problem:

  1. Unclone the views and set them side by side.
  2. Learn how to move windows between desktops in xmonad and how to switch desktops.

To unclone, use xrandr to set different views for each monitor.

Open a console and type:

$xrandr 

It should display something along the lines:

LVDS1 connected 1280x800+0+0 (normal left inverted right x axis y axis) 331mm x 207mm
   1280x800       60.0*+
   1024x768       60.0  
   800x600        60.3     56.2  
   640x480        59.9  
VGA1 connected (normal left inverted right x axis y axis)
   1024x768       60.0 +   85.0     75.1     70.1  
   1280x1024      75.0     60.0  
   1280x960       75.0     60.0  
   1152x864       75.0  
   832x624        74.6  
   800x600        85.1     72.2     75.0     60.3     56.2  
   640x480        85.0     72.8     75.0     60.0  
   720x400        70.1  
TV1 disconnected (normal left inverted right x axis y axis)

In my case LVDS1 is the laptop and VGA1 is a connected projector.

To set the projector left of the monitor use:

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

This will use the default resolution for the projector (in this case 1024x768) and place the view left of the laptop screen.

To set a custom resolution use

$xrandr --output VGA1 --mode 1280x800 --left-of LVDS1

In your case it will be something along the lines:

$xrandr --output MONITOR2 --auto --left-of MONITOR1

The shortcuts for moving apps between desktops and switching desktops are

Mod Key + 1,2,3, - 9 for bringing the desktop to the monitor the mouse is on

Mod Key + SHIFT + 1,2,3, - 9 for sending the currently focused application to the particular desktop

The default Mod Key for xmonad is Alt but you can set it to the Windows key in order to free Alt for use in applications.

Related Question