Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

migrated from stackoverflow.com Sep 23 '12 at 5:38

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

2 Answers

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 http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-SpawnOn.html for details.

share|improve this answer
1  
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
add comment
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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