Search code examples
windowpositionxmonad

xmonad - open a window into a particular tile


I have three terminals running monitor commands which load on login. I have the workspace configured as default, 2/3 on the left, 1/3 on the right with the right tile split 1/1 vertically. I would like to control which tile each terminal lands on from within xmonad.hs but I'm unsure of what functions I need to use. I'm guessing a new Mangehook will be in order, but beyond that I'm lost.

Any pointers gratefully accepted.

TIA


Solution

  • Currently i'm using a dirty hack by lagged spawning of the applications:

    myStartupHook = do
        spawnOn     "workspace" "app3"
        spawnOn     "workspace" "sleep 0.5; app2"
        spawnOn     "workspace" "sleep 1; app1" -- will be placed in master if default not changed, see last paragraph
    

    Mr. Know-it-all Geekosaur in the #xmonad channel pointed out that you can also do

    spawnAndDo  (doShift "workspace" <+> doF W.shiftMaster) "app"
    

    but this only works well if you want one app in master and one in slave. Otherwise you run into the same issue as before...

    Please have also a look at XMonad.Hook.InsertPosition from the contrib package. With it's help you can redefine the default position where a new window is added - maybe this is helpful for you.

    Edit: I came up with another method: For placing mutt top left, newsbeuter bottom left and irssi on the whole right side i combine layouts and sort the placement (wheter on master or slave) by ComboP. For placing mutt on top i use Geekosaurs hint from above.

    Relevant code:

    import XMonad.Layout.TwoPane
    import XMonad.Layout.ComboP
    ...
    myLayout =  combineTwoP (TwoPane (3/100) (2/3)) (Mirror $ ResizableTall 1 (3/100) (2/3) []) (ResizableTall 1 (3/100) (1/2) []) (Title "mutt" `Or` Title "newsbeuter")
    

    Check out the docs to modify my setup fitting you needs: XMonad.Layout.ComboP, XMonad.Layout.TwoPane.