I would like to have my programs spawn on the screen that was in focus when its keybinding was pressed not on the screen thats currently in focus when it finishes loading.
Why: My current setup is Arch Linux + XMonad and I have it running on 6 monitors. I have been using XMonad for about a year now and my only issue with it is for programs that take a little while to open. For example the very first time I start chromium it takes 3 odd seconds to load. I press my key binding for chrome and then go to a different screen to do something else. But when chrome loads it loads on the screen im currently focused on not on the screen that was focused at the time the spawn key binding was pressed.
My haskell skills are well... non existent. I have programmed in Lisp before and spend a lot of time in C, python and JavaScript so im sure I can pick it up if need be (so please be clear when it comes to haskell samples in answers).
Thanks in advance.
I found the answer to my own question.
First you must add to your imports:
import XMonad.Actions.SpawnOn
Then under your main function have something like:
main = do
xmonad $ defaultConfig
{
manageHook = myManageHooks <+> manageSpawn <+> manageDocks <+> manageHook defaultConfig
, startupHook = myStartupHook
, ETC.....
The key here was the addition of the manageSpawn
in the manageHook
line.
Then replace your spawn
s with spawnHere
:
, ((modMask, xK_w), spawn "chromium")
Becomes:
, ((modMask, xK_w), spawnHere "chromium")
来源:https://stackoverflow.com/questions/10752325/xmonad-spawnon-workspace-that-had-focus-when-spawn-key-was-pressed