简体   繁体   中英

XMonad startup on different workspaces

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?

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 className s might vary, though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM