Search code examples
haskellxmonad

XMonad spawn programs on startup in specified workspace


I am trying to configure my xmonad.hs so that when I start my session I start an array of different programs on different workspaces (like Terminal in 1 ; Firefox in 2 ; Pidgin in 3).

I already looked into the XMonad.Actions.SpawnOn, but as spawnOn returns with an X () and not with a common m () I can not use it in main = do ....

Is there a function that takes an X-monad and returns with IO () or is there another workaround?


Solution

  • The common way is to use startupHook which takes X () action and performs it on each startup. E.g.

    main = xmonad $ defaultConfig
      { startupHook = do
          spawnOn "workspace1" "program1"
          …
          spawnOn "workspaceN" "programN"
      }