I'm using xmonad with a dual monitor setup.

Here is a stripped down version of my config:

import XMonad

main = do
  xmonad $ defaultConfig { 
    workspaces  = ["1:db", "2:mail", "3:web", "4:dev", "5", "6", "7", "8:chat", "9", "10"]

Is there a way to configure it so that my left screen defaults to workspace 2:mail and right screen to workspace 3:web ?

  • Did you ever figure this out? :)
    – mitchus
    Jul 12, 2017 at 9:05
  • Switched to i3 a while back
    – ilia choly
    Jul 12, 2017 at 11:50

3 Answers 3


Yes. There are two ways to achieve it:

  1. A trick to reorder your workspaces (assuming your left screen is the primary screen, you can use xrandr -q to check) workspaces = ["2:mail", "3:web", "4:dev", "5", "6", "7", "8:chat", "9", "10", "1:db"] associatedKeySyms = [xK_2 .. xK_9] ++ [xK_0, xK_1] The key here is the order of associatedKeySyms, since xmonad does not care the names for your workspaces. If you do not display the workspace names on your status bar, this will work. An even simpler way is to just change associatedKeySyms without changing workspaces. However, if you do need to display the workspace names (you may want to see "1:db" comes first and associated with mod+1), then you need to follow the next solution.

  2. Basically you need to hack StackSet in XMonad.StackSet (https://github.com/xmonad/xmonad/blob/master/src/XMonad/StackSet.hs) to manipulate the binding between screens and workspaces. You need to write the code into a startupHook in your config file so that it will be executed when xmonad is loaded.

You may also need XMonad.Actions.PhysicalScreens if you want to specify right or left screens instead of screen IDs.

I just start using xmonad, and I haven't done exactly what you want. I have similar needs, yet not only at xmonad startup. I try to hack both the startup procedure and the rescreen procedure (new monitor connected/disconnected), and hope you find some pieces of my configuration useful when you write yours. https://github.com/subbyte/subXMonad

  • Hacking associatedKeySyms is pretty clever (+1). There may also be a way of making the remapping work with xmodmap but am not confident that xmonad will not catch the keys before the Xorg map.
    – grochmal
    Jul 30, 2017 at 15:52

Just if someone stumbles upon this from google: You have to import this:

import XMonad.Actions.OnScreen

Now in your startuphook you can change the workspace during startup of xmonad with this line:

    windows (greedyViewOnScreen 0 "xyz")

to display workspace xyz on screen 0. The xyz is the workspaces name, not the indice. In xmonad.hs there is a line that says:

workspaces = ["xyz", "abc", "blablabla"...]

Note that greedyViewOnScreen grabs the workspace from a different monitors on puts it on the specified screen. If you don't want this, there are several similar commands here: XMonad.Actions.OnScreen


I had some success using functions from XMonad.Actions.OnScreen, for example the following shows workspace "5" on screen 1:

, startupHook = do
    modify $ \xstate -> xstate { windowset = onlyOnScreen 1 "5" (windowset xstate) }

However there were sometimes issues with redrawing the screen - the workspace was drawn only after I move the mouse to the screen.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.