2

I want to startup some applications in different workspaces(it is important) on xmonad start. So, I wrote following startupHook:

startupApps :: [String]
startupApps = ["konsole", "emacs", "firefox", "gvim", "konsole"]

startupSpawn :: X ()
startupSpawn =  zipWithM_ id (map (spawnOn . show) [1..])  startupApps

But, it spawns all apps in first workspace. It seems to be part of more general problem -- if I start application, it get workspace not when it actually started, but when it loaded. So, if I start firefox on WS1, then switch to WS2, firefox will spawn on WS2.

Still, what can I do about my intention?

KAction
  • 1,977
  • 15
  • 31
  • Have you checked out this answer? http://superuser.com/questions/478498/start-applications-on-specific-workspaces-in-xmonad – Noon Silk Nov 07 '12 at 23:08

1 Answers1

3

You can use the manageHook to tell xmonad to move certain applications to certain desktops.

myManageHook = composeAll . concat $ [
    [ className =? "Firefox" --> doF (shiftToWs 2) ]
  , [ className =? "gvim" --> doF (shiftToWs 3) ]
  -- and so on
  ]

The classNames might vary, though.

bitmask
  • 32,434
  • 14
  • 99
  • 159
  • When would this run, though? Would it run on every action? Because it'd be quite annoying not to be able to shift windows on purpose ... – Noon Silk Nov 07 '12 at 23:23
  • 1
    @NoonSilk: No, it only applies when you *open a new window*. Afterwards you can arbitrarily move a window around. – bitmask Nov 07 '12 at 23:32
  • 2
    Note that `concat [[x],[y]]` is equal to `[x,y]` so example is a bit cluttered. – Matvey Aksenov Nov 08 '12 at 09:32
  • @MatveyAksenov: You have a point, but there must have been a good reason to put this in my config. Quite strange. – bitmask Nov 08 '12 at 09:54