Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know how to associate specific applications with specific workspaces using manageHook and composeAll. What I'm looking for is a way to spawn applications on specific workspaces, i.e. a function with type signature String -> workSpaceId -> X () whose example use would be something like:

spawnToWorkspace "emacs" "2:code"
share|improve this question

migrated from Sep 23 '12 at 5:38

This question came from our site for professional and enthusiast programmers.

The more correct (and modern; I don't think SpawnOn was in the released XMonad back then, an awful lot of good stuff was only in darcs) way to do this is to

import XMonad.Actions.SpawnOn

and then use the action

spawnOn "2:code" "emacs"

See for details.

share|improve this answer
Does this still work? I'm on xmonad 0.10 and using spawnOn still seems to just spawn the application on the current workspace... – bhh1988 Aug 5 '12 at 4:41
up vote 3 down vote accepted

Okay, it was actually easier than I thought:

spawnToWorkspace :: String -> String -> X ()
spawnToWorkspace program workspace = do
                                      spawn program     
                                      windows $ W.greedyView workspace
share|improve this answer
This is the only solution that seems to work, it appears that spawnOn from XMonad-Contrib is broken with newer versions of XMonad. – eazar001 Nov 11 '13 at 5:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .