4

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

Tony Martin
  • 337
  • 1
  • 12

1 Answers1

3

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.

Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286
deshtop
  • 745
  • 5
  • 15
  • I'll try them all in time, but for now, putting the subordinate windows at the beginning of the StartupHook and the master at the end seems to be working. Obvious once it's been suggested :-) Thanks for your suggestions. – Tony Martin Nov 13 '14 at 06:30
  • Certainly very useful tools for the layout toolbox. But for the particular problem I'm looking at not useful as the three windows are all xterms running different monitor commands. Thanks again for your comprehensive advice and links. – Tony Martin Nov 14 '14 at 07:31
  • 1
    @tony-martin Above are commanline apps as well. Use ``xprop`` to check if the window name reflects the running monitors. Maybe you need to set dynamic titles for xterm first. – deshtop Nov 14 '14 at 13:54
  • This last solution worked perfectly as far as laying out the windows exactly as I want them. However, the layout indicator on xmobar gives a full description of the layout, taking up the entire space. Is there anyway I could alias the layout so that a shorter indicator will display. Thanks again for these great pointers. – Tony Martin Nov 16 '14 at 23:24
  • 1
    @tony-martin The easiest way to go is renaming your layout by ``myLayout = named "layoutname" $ combineTwoP ...`` after importing ``XMonad.Layout.Named``. You can even add colors like ``"fancy layoutname"``. – deshtop Nov 17 '14 at 16:53
  • Mistake above, should be ``"fancy layoutname"``! – deshtop Nov 17 '14 at 17:02
  • Excellent explanation. Not only does it solve my original problem, it's suggested a lot of ideas for customising my layout further. – Tony Martin Nov 17 '14 at 23:16
  • What's more, they can be aliased to an clickable icon with something like this: `fLayout = named "" $ Full` – Tony Martin Nov 28 '14 at 00:46