
Thanks Brandon!
I've updated my config
https://github.com/fommil/dotfiles/blob/master/xmonad/xmonad.hs
and now my three apps startup on the correct workspaces! No apparent
issues with chromium.
Unfortunately, this doesn't seem to have fixed the --reload problem, so
I guess args is always coming up non-null?
Brandon Allbery
On Fri, Mar 24, 2017 at 6:19 AM, Sam Halliday
wrote: Following http://stackoverflow.com/questions/10976044/ I have added the following to my `startupHook`
startup :: X () startup = do setWMName "LG3D" spawnOn "workspace1" "urxvt" spawnOn "workspace2" "emacs" spawnOn "workspace3" "chromium"
but there are three problems:
1. I am duplicating the definition of my terminal. It seems like I should be using [`shellPromptOn`](http://xmonad.org/xmonad-docs/xmonad- contrib/XMonad-Actions-SpawnOn.html) but it takes an extra parameter and I don't know where to get it from.
No, that's an interactive prompt at a screen edge that asks for a command, with built-in completion, and passes it to a shell. There is no terminal involved, unless that is what you tell it to launch. (The `XPConfig` is the configuration for an XMonad.Prompt screen edge popup window.)
2. this is putting everything on my current workspace. How can I find
out what my workspaces are called? I don't believe I've customised the names, you can see [my .xmonad/xmonad.hs on github to confirm](https://github.com/fommil/dotfiles/blob/master/. xmonad/xmonad.hs)
You indeed haven't, so your workspaces are "1", "2", ... "9".
You're also missing manageSpawn in the manageHook, so nothing ever gets moved anyway.
3. This will start the apps again on a `xmonad --restart`. How can we
guard against that? It is very useful to be able to restart xmonad without quitting and I don't want to lose that ability.
There isn't anything that combines the functionality of spawnOnce and spawnOn currently. I replace the spawnOnce with a bit of a hack that checks whether xmonad was launched with parameters (which it normally isn't, but a restart passes the old state). Using your config as a template:
import Control.Monad import System.Environment
main = do args <- getArgs xmonad $ ewmh $ withUrgencyHook dzenUrgencyHook { args = ["-bg", "darkgreen", "-xs", "1"] } $ defaultConfig { terminal = "urxvt" , startupHook = startup (null args) *-- and the rest here...* }
startup :: Bool -> X () startup initial = do setWMName "LG3D" when initial $ do spawnOn "1" "urxvt" spawnOn "2" "emacs" spawnOn "3" "chromium"
Note also that chromium can misbehave with spawnOn because we have to rely on the window registering the same associated process ID as the one we get back from running it, and it often isn't. See https://wiki.haskell.org/Xmonad/General_xmonad.hs_config_tips#Terminal_emula... for more information. (chromium is a bit worse in that many versions of its wrapper script fork, so the pid will *never* match.)
-- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
-- Best regards, Sam