5

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 '17 at 9:05
  • Switched to i3 a while back – ilia choly Jul 12 '17 at 11:50
2

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 '17 at 15:52

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.